001package org.hl7.fhir.r4.formats;
002
003import java.io.IOException;
004
005import org.hl7.fhir.exceptions.FHIRFormatError;
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 Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
037import org.hl7.fhir.r4.model.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
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  public JsonParser(boolean allowUnknownContent, boolean allowComments) {
057    super();
058    setAllowUnknownContent(allowUnknownContent);
059    setAllowComments(allowComments);
060  }
061
062  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
063    super.parseElementProperties(json, element);
064    if (json.has("extension")) {
065      JsonArray array = json.getAsJsonArray("extension");
066      for (int i = 0; i < array.size(); i++) {
067        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
068      }
069    }
070    ;
071  }
072
073  protected void parseBackboneElementProperties(JsonObject json, BackboneElement element)
074      throws IOException, FHIRFormatError {
075    parseElementProperties(json, element);
076    if (json.has("modifierExtension")) {
077      JsonArray array = json.getAsJsonArray("modifierExtension");
078      for (int i = 0; i < array.size(); i++) {
079        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
080      }
081    }
082  }
083
084  protected void parseBackboneElementProperties(JsonObject json, BackboneType element)
085      throws IOException, FHIRFormatError {
086    parseElementProperties(json, element);
087    if (json.has("modifierExtension")) {
088      JsonArray array = json.getAsJsonArray("modifierExtension");
089      for (int i = 0; i < array.size(); i++) {
090        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
091      }
092    }
093  }
094
095  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
096    parseElementProperties(json, element);
097  }
098
099  @SuppressWarnings("unchecked")
100  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e)
101      throws IOException, FHIRFormatError {
102    Enumeration<E> res = new Enumeration<E>(e);
103    if (s != null)
104      res.setValue((E) e.fromCode(s));
105    return res;
106  }
107
108  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
109    DateType res = new DateType(v);
110    return res;
111  }
112
113  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
114    DateTimeType res = new DateTimeType(v);
115    return res;
116  }
117
118  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
119    CodeType res = new CodeType(v);
120    return res;
121  }
122
123  protected StringType parseString(String v) throws IOException, FHIRFormatError {
124    StringType res = new StringType(v);
125    return res;
126  }
127
128  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
129    IntegerType res = new IntegerType(v);
130    return res;
131  }
132
133  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
134    OidType res = new OidType(v);
135    return res;
136  }
137
138  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
139    CanonicalType res = new CanonicalType(v);
140    return res;
141  }
142
143  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
144    UriType res = new UriType(v);
145    return res;
146  }
147
148  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
149    UuidType res = new UuidType(v);
150    return res;
151  }
152
153  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
154    UrlType res = new UrlType(v);
155    return res;
156  }
157
158  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
159    InstantType res = new InstantType(v);
160    return res;
161  }
162
163  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
164    BooleanType res = new BooleanType(v);
165    return res;
166  }
167
168  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
169    Base64BinaryType res = new Base64BinaryType(v);
170    return res;
171  }
172
173  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
174    UnsignedIntType res = new UnsignedIntType(v);
175    return res;
176  }
177
178  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
179    MarkdownType res = new MarkdownType(v);
180    return res;
181  }
182
183  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
184    TimeType res = new TimeType(v);
185    return res;
186  }
187
188  protected IdType parseId(String v) throws IOException, FHIRFormatError {
189    IdType res = new IdType(v);
190    return res;
191  }
192
193  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
194    PositiveIntType res = new PositiveIntType(v);
195    return res;
196  }
197
198  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
199    DecimalType res = new DecimalType(v);
200    if (v instanceof PresentedBigDecimal)
201      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
202    return res;
203  }
204
205  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
206    Extension res = new Extension();
207    parseExtensionProperties(json, res);
208    return res;
209  }
210
211  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
212    parseTypeProperties(json, res);
213    if (json.has("url"))
214      res.setUrlElement(parseUri(json.get("url").getAsString()));
215    if (json.has("_url"))
216      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
217    Type value = parseType("value", json);
218    if (value != null)
219      res.setValue(value);
220  }
221
222  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
223    Narrative res = new Narrative();
224    parseNarrativeProperties(json, res);
225    return res;
226  }
227
228  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
229    parseTypeProperties(json, res);
230    if (json.has("status"))
231      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL,
232          new Narrative.NarrativeStatusEnumFactory()));
233    if (json.has("_status"))
234      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
235    if (json.has("div"))
236      res.setDiv(parseXhtml(json.get("div").getAsString()));
237  }
238
239  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
240    Meta res = new Meta();
241    parseMetaProperties(json, res);
242    return res;
243  }
244
245  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
246    parseElementProperties(json, res);
247    if (json.has("versionId"))
248      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
249    if (json.has("_versionId"))
250      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
251    if (json.has("lastUpdated"))
252      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
253    if (json.has("_lastUpdated"))
254      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
255    if (json.has("source"))
256      res.setSourceElement(parseUri(json.get("source").getAsString()));
257    if (json.has("_source"))
258      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
259    if (json.has("profile")) {
260      JsonArray array = json.getAsJsonArray("profile");
261      for (int i = 0; i < array.size(); i++) {
262        if (array.get(i).isJsonNull()) {
263          res.getProfile().add(new CanonicalType());
264        } else {
265          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
266        }
267      }
268    }
269    ;
270    if (json.has("_profile")) {
271      JsonArray array = json.getAsJsonArray("_profile");
272      for (int i = 0; i < array.size(); i++) {
273        if (i == res.getProfile().size())
274          res.getProfile().add(parseCanonical(null));
275        if (array.get(i) instanceof JsonObject)
276          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
277      }
278    }
279    ;
280    if (json.has("security")) {
281      JsonArray array = json.getAsJsonArray("security");
282      for (int i = 0; i < array.size(); i++) {
283        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
284      }
285    }
286    ;
287    if (json.has("tag")) {
288      JsonArray array = json.getAsJsonArray("tag");
289      for (int i = 0; i < array.size(); i++) {
290        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
291      }
292    }
293    ;
294  }
295
296  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
297    Address res = new Address();
298    parseAddressProperties(json, res);
299    return res;
300  }
301
302  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
303    parseTypeProperties(json, res);
304    if (json.has("use"))
305      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL,
306          new Address.AddressUseEnumFactory()));
307    if (json.has("_use"))
308      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
309    if (json.has("type"))
310      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL,
311          new Address.AddressTypeEnumFactory()));
312    if (json.has("_type"))
313      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
314    if (json.has("text"))
315      res.setTextElement(parseString(json.get("text").getAsString()));
316    if (json.has("_text"))
317      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
318    if (json.has("line")) {
319      JsonArray array = json.getAsJsonArray("line");
320      for (int i = 0; i < array.size(); i++) {
321        if (array.get(i).isJsonNull()) {
322          res.getLine().add(new StringType());
323        } else {
324          res.getLine().add(parseString(array.get(i).getAsString()));
325        }
326      }
327    }
328    ;
329    if (json.has("_line")) {
330      JsonArray array = json.getAsJsonArray("_line");
331      for (int i = 0; i < array.size(); i++) {
332        if (i == res.getLine().size())
333          res.getLine().add(parseString(null));
334        if (array.get(i) instanceof JsonObject)
335          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
336      }
337    }
338    ;
339    if (json.has("city"))
340      res.setCityElement(parseString(json.get("city").getAsString()));
341    if (json.has("_city"))
342      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
343    if (json.has("district"))
344      res.setDistrictElement(parseString(json.get("district").getAsString()));
345    if (json.has("_district"))
346      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
347    if (json.has("state"))
348      res.setStateElement(parseString(json.get("state").getAsString()));
349    if (json.has("_state"))
350      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
351    if (json.has("postalCode"))
352      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
353    if (json.has("_postalCode"))
354      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
355    if (json.has("country"))
356      res.setCountryElement(parseString(json.get("country").getAsString()));
357    if (json.has("_country"))
358      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
359    if (json.has("period"))
360      res.setPeriod(parsePeriod(getJObject(json, "period")));
361  }
362
363  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
364    Contributor res = new Contributor();
365    parseContributorProperties(json, res);
366    return res;
367  }
368
369  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
370    parseTypeProperties(json, res);
371    if (json.has("type"))
372      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL,
373          new Contributor.ContributorTypeEnumFactory()));
374    if (json.has("_type"))
375      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
376    if (json.has("name"))
377      res.setNameElement(parseString(json.get("name").getAsString()));
378    if (json.has("_name"))
379      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
380    if (json.has("contact")) {
381      JsonArray array = json.getAsJsonArray("contact");
382      for (int i = 0; i < array.size(); i++) {
383        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
384      }
385    }
386    ;
387  }
388
389  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
390    Attachment res = new Attachment();
391    parseAttachmentProperties(json, res);
392    return res;
393  }
394
395  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
396    parseTypeProperties(json, res);
397    if (json.has("contentType"))
398      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
399    if (json.has("_contentType"))
400      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
401    if (json.has("language"))
402      res.setLanguageElement(parseCode(json.get("language").getAsString()));
403    if (json.has("_language"))
404      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
405    if (json.has("data"))
406      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
407    if (json.has("_data"))
408      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
409    if (json.has("url"))
410      res.setUrlElement(parseUrl(json.get("url").getAsString()));
411    if (json.has("_url"))
412      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
413    if (json.has("size"))
414      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
415    if (json.has("_size"))
416      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
417    if (json.has("hash"))
418      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
419    if (json.has("_hash"))
420      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
421    if (json.has("title"))
422      res.setTitleElement(parseString(json.get("title").getAsString()));
423    if (json.has("_title"))
424      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
425    if (json.has("creation"))
426      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
427    if (json.has("_creation"))
428      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
429  }
430
431  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
432    Count res = new Count();
433    parseCountProperties(json, res);
434    return res;
435  }
436
437  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
438    parseQuantityProperties(json, res);
439  }
440
441  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
442    DataRequirement res = new DataRequirement();
443    parseDataRequirementProperties(json, res);
444    return res;
445  }
446
447  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res)
448      throws IOException, FHIRFormatError {
449    parseTypeProperties(json, res);
450    if (json.has("type"))
451      res.setTypeElement(parseCode(json.get("type").getAsString()));
452    if (json.has("_type"))
453      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
454    if (json.has("profile")) {
455      JsonArray array = json.getAsJsonArray("profile");
456      for (int i = 0; i < array.size(); i++) {
457        if (array.get(i).isJsonNull()) {
458          res.getProfile().add(new CanonicalType());
459        } else {
460          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
461        }
462      }
463    }
464    ;
465    if (json.has("_profile")) {
466      JsonArray array = json.getAsJsonArray("_profile");
467      for (int i = 0; i < array.size(); i++) {
468        if (i == res.getProfile().size())
469          res.getProfile().add(parseCanonical(null));
470        if (array.get(i) instanceof JsonObject)
471          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
472      }
473    }
474    ;
475    Type subject = parseType("subject", json);
476    if (subject != null)
477      res.setSubject(subject);
478    if (json.has("mustSupport")) {
479      JsonArray array = json.getAsJsonArray("mustSupport");
480      for (int i = 0; i < array.size(); i++) {
481        if (array.get(i).isJsonNull()) {
482          res.getMustSupport().add(new StringType());
483        } else {
484          res.getMustSupport().add(parseString(array.get(i).getAsString()));
485        }
486      }
487    }
488    ;
489    if (json.has("_mustSupport")) {
490      JsonArray array = json.getAsJsonArray("_mustSupport");
491      for (int i = 0; i < array.size(); i++) {
492        if (i == res.getMustSupport().size())
493          res.getMustSupport().add(parseString(null));
494        if (array.get(i) instanceof JsonObject)
495          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
496      }
497    }
498    ;
499    if (json.has("codeFilter")) {
500      JsonArray array = json.getAsJsonArray("codeFilter");
501      for (int i = 0; i < array.size(); i++) {
502        res.getCodeFilter()
503            .add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
504      }
505    }
506    ;
507    if (json.has("dateFilter")) {
508      JsonArray array = json.getAsJsonArray("dateFilter");
509      for (int i = 0; i < array.size(); i++) {
510        res.getDateFilter()
511            .add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
512      }
513    }
514    ;
515    if (json.has("limit"))
516      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
517    if (json.has("_limit"))
518      parseElementProperties(getJObject(json, "_limit"), res.getLimitElement());
519    if (json.has("sort")) {
520      JsonArray array = json.getAsJsonArray("sort");
521      for (int i = 0; i < array.size(); i++) {
522        res.getSort().add(parseDataRequirementDataRequirementSortComponent(array.get(i).getAsJsonObject(), res));
523      }
524    }
525    ;
526  }
527
528  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(
529      JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
530    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
531    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
532    return res;
533  }
534
535  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json,
536      DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res)
537      throws IOException, FHIRFormatError {
538    parseTypeProperties(json, res);
539    if (json.has("path"))
540      res.setPathElement(parseString(json.get("path").getAsString()));
541    if (json.has("_path"))
542      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
543    if (json.has("searchParam"))
544      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
545    if (json.has("_searchParam"))
546      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
547    if (json.has("valueSet"))
548      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
549    if (json.has("_valueSet"))
550      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
551    if (json.has("code")) {
552      JsonArray array = json.getAsJsonArray("code");
553      for (int i = 0; i < array.size(); i++) {
554        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
555      }
556    }
557    ;
558  }
559
560  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(
561      JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
562    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
563    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
564    return res;
565  }
566
567  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json,
568      DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res)
569      throws IOException, FHIRFormatError {
570    parseTypeProperties(json, res);
571    if (json.has("path"))
572      res.setPathElement(parseString(json.get("path").getAsString()));
573    if (json.has("_path"))
574      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
575    if (json.has("searchParam"))
576      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
577    if (json.has("_searchParam"))
578      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
579    Type value = parseType("value", json);
580    if (value != null)
581      res.setValue(value);
582  }
583
584  protected DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(
585      JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
586    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
587    parseDataRequirementDataRequirementSortComponentProperties(json, owner, res);
588    return res;
589  }
590
591  protected void parseDataRequirementDataRequirementSortComponentProperties(JsonObject json, DataRequirement owner,
592      DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
593    parseTypeProperties(json, res);
594    if (json.has("path"))
595      res.setPathElement(parseString(json.get("path").getAsString()));
596    if (json.has("_path"))
597      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
598    if (json.has("direction"))
599      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL,
600          new DataRequirement.SortDirectionEnumFactory()));
601    if (json.has("_direction"))
602      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
603  }
604
605  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
606    Dosage res = new Dosage();
607    parseDosageProperties(json, res);
608    return res;
609  }
610
611  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
612    parseBackboneElementProperties(json, res);
613    if (json.has("sequence"))
614      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
615    if (json.has("_sequence"))
616      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
617    if (json.has("text"))
618      res.setTextElement(parseString(json.get("text").getAsString()));
619    if (json.has("_text"))
620      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
621    if (json.has("additionalInstruction")) {
622      JsonArray array = json.getAsJsonArray("additionalInstruction");
623      for (int i = 0; i < array.size(); i++) {
624        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
625      }
626    }
627    ;
628    if (json.has("patientInstruction"))
629      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
630    if (json.has("_patientInstruction"))
631      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
632    if (json.has("timing"))
633      res.setTiming(parseTiming(getJObject(json, "timing")));
634    Type asNeeded = parseType("asNeeded", json);
635    if (asNeeded != null)
636      res.setAsNeeded(asNeeded);
637    if (json.has("site"))
638      res.setSite(parseCodeableConcept(getJObject(json, "site")));
639    if (json.has("route"))
640      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
641    if (json.has("method"))
642      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
643    if (json.has("doseAndRate")) {
644      JsonArray array = json.getAsJsonArray("doseAndRate");
645      for (int i = 0; i < array.size(); i++) {
646        res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(array.get(i).getAsJsonObject(), res));
647      }
648    }
649    ;
650    if (json.has("maxDosePerPeriod"))
651      res.setMaxDosePerPeriod(parseRatio(getJObject(json, "maxDosePerPeriod")));
652    if (json.has("maxDosePerAdministration"))
653      res.setMaxDosePerAdministration(parseQuantity(getJObject(json, "maxDosePerAdministration")));
654    if (json.has("maxDosePerLifetime"))
655      res.setMaxDosePerLifetime(parseQuantity(getJObject(json, "maxDosePerLifetime")));
656  }
657
658  protected Dosage.DosageDoseAndRateComponent parseDosageDosageDoseAndRateComponent(JsonObject json, Dosage owner)
659      throws IOException, FHIRFormatError {
660    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
661    parseDosageDosageDoseAndRateComponentProperties(json, owner, res);
662    return res;
663  }
664
665  protected void parseDosageDosageDoseAndRateComponentProperties(JsonObject json, Dosage owner,
666      Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
667    parseTypeProperties(json, res);
668    if (json.has("type"))
669      res.setType(parseCodeableConcept(getJObject(json, "type")));
670    Type dose = parseType("dose", json);
671    if (dose != null)
672      res.setDose(dose);
673    Type rate = parseType("rate", json);
674    if (rate != null)
675      res.setRate(rate);
676  }
677
678  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
679    Money res = new Money();
680    parseMoneyProperties(json, res);
681    return res;
682  }
683
684  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
685    parseTypeProperties(json, res);
686    if (json.has("value"))
687      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
688    if (json.has("_value"))
689      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
690    if (json.has("currency"))
691      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
692    if (json.has("_currency"))
693      parseElementProperties(getJObject(json, "_currency"), res.getCurrencyElement());
694  }
695
696  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
697    HumanName res = new HumanName();
698    parseHumanNameProperties(json, res);
699    return res;
700  }
701
702  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
703    parseTypeProperties(json, res);
704    if (json.has("use"))
705      res.setUseElement(
706          parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
707    if (json.has("_use"))
708      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
709    if (json.has("text"))
710      res.setTextElement(parseString(json.get("text").getAsString()));
711    if (json.has("_text"))
712      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
713    if (json.has("family"))
714      res.setFamilyElement(parseString(json.get("family").getAsString()));
715    if (json.has("_family"))
716      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
717    if (json.has("given")) {
718      JsonArray array = json.getAsJsonArray("given");
719      for (int i = 0; i < array.size(); i++) {
720        if (array.get(i).isJsonNull()) {
721          res.getGiven().add(new StringType());
722        } else {
723          res.getGiven().add(parseString(array.get(i).getAsString()));
724        }
725      }
726    }
727    ;
728    if (json.has("_given")) {
729      JsonArray array = json.getAsJsonArray("_given");
730      for (int i = 0; i < array.size(); i++) {
731        if (i == res.getGiven().size())
732          res.getGiven().add(parseString(null));
733        if (array.get(i) instanceof JsonObject)
734          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
735      }
736    }
737    ;
738    if (json.has("prefix")) {
739      JsonArray array = json.getAsJsonArray("prefix");
740      for (int i = 0; i < array.size(); i++) {
741        if (array.get(i).isJsonNull()) {
742          res.getPrefix().add(new StringType());
743        } else {
744          res.getPrefix().add(parseString(array.get(i).getAsString()));
745        }
746      }
747    }
748    ;
749    if (json.has("_prefix")) {
750      JsonArray array = json.getAsJsonArray("_prefix");
751      for (int i = 0; i < array.size(); i++) {
752        if (i == res.getPrefix().size())
753          res.getPrefix().add(parseString(null));
754        if (array.get(i) instanceof JsonObject)
755          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
756      }
757    }
758    ;
759    if (json.has("suffix")) {
760      JsonArray array = json.getAsJsonArray("suffix");
761      for (int i = 0; i < array.size(); i++) {
762        if (array.get(i).isJsonNull()) {
763          res.getSuffix().add(new StringType());
764        } else {
765          res.getSuffix().add(parseString(array.get(i).getAsString()));
766        }
767      }
768    }
769    ;
770    if (json.has("_suffix")) {
771      JsonArray array = json.getAsJsonArray("_suffix");
772      for (int i = 0; i < array.size(); i++) {
773        if (i == res.getSuffix().size())
774          res.getSuffix().add(parseString(null));
775        if (array.get(i) instanceof JsonObject)
776          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
777      }
778    }
779    ;
780    if (json.has("period"))
781      res.setPeriod(parsePeriod(getJObject(json, "period")));
782  }
783
784  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
785    ContactPoint res = new ContactPoint();
786    parseContactPointProperties(json, res);
787    return res;
788  }
789
790  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
791    parseTypeProperties(json, res);
792    if (json.has("system"))
793      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL,
794          new ContactPoint.ContactPointSystemEnumFactory()));
795    if (json.has("_system"))
796      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
797    if (json.has("value"))
798      res.setValueElement(parseString(json.get("value").getAsString()));
799    if (json.has("_value"))
800      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
801    if (json.has("use"))
802      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL,
803          new ContactPoint.ContactPointUseEnumFactory()));
804    if (json.has("_use"))
805      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
806    if (json.has("rank"))
807      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
808    if (json.has("_rank"))
809      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
810    if (json.has("period"))
811      res.setPeriod(parsePeriod(getJObject(json, "period")));
812  }
813
814  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
815    MarketingStatus res = new MarketingStatus();
816    parseMarketingStatusProperties(json, res);
817    return res;
818  }
819
820  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res)
821      throws IOException, FHIRFormatError {
822    parseBackboneElementProperties(json, res);
823    if (json.has("country"))
824      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
825    if (json.has("jurisdiction"))
826      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
827    if (json.has("status"))
828      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
829    if (json.has("dateRange"))
830      res.setDateRange(parsePeriod(getJObject(json, "dateRange")));
831    if (json.has("restoreDate"))
832      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
833    if (json.has("_restoreDate"))
834      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
835  }
836
837  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
838    Identifier res = new Identifier();
839    parseIdentifierProperties(json, res);
840    return res;
841  }
842
843  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
844    parseTypeProperties(json, res);
845    if (json.has("use"))
846      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL,
847          new Identifier.IdentifierUseEnumFactory()));
848    if (json.has("_use"))
849      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
850    if (json.has("type"))
851      res.setType(parseCodeableConcept(getJObject(json, "type")));
852    if (json.has("system"))
853      res.setSystemElement(parseUri(json.get("system").getAsString()));
854    if (json.has("_system"))
855      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
856    if (json.has("value"))
857      res.setValueElement(parseString(json.get("value").getAsString()));
858    if (json.has("_value"))
859      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
860    if (json.has("period"))
861      res.setPeriod(parsePeriod(getJObject(json, "period")));
862    if (json.has("assigner"))
863      res.setAssigner(parseReference(getJObject(json, "assigner")));
864  }
865
866  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
867    SubstanceAmount res = new SubstanceAmount();
868    parseSubstanceAmountProperties(json, res);
869    return res;
870  }
871
872  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res)
873      throws IOException, FHIRFormatError {
874    parseBackboneElementProperties(json, res);
875    Type amount = parseType("amount", json);
876    if (amount != null)
877      res.setAmount(amount);
878    if (json.has("amountType"))
879      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
880    if (json.has("amountText"))
881      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
882    if (json.has("_amountText"))
883      parseElementProperties(getJObject(json, "_amountText"), res.getAmountTextElement());
884    if (json.has("referenceRange"))
885      res.setReferenceRange(
886          parseSubstanceAmountSubstanceAmountReferenceRangeComponent(getJObject(json, "referenceRange"), res));
887  }
888
889  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(
890      JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
891    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
892    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
893    return res;
894  }
895
896  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json,
897      SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res)
898      throws IOException, FHIRFormatError {
899    parseTypeProperties(json, res);
900    if (json.has("lowLimit"))
901      res.setLowLimit(parseQuantity(getJObject(json, "lowLimit")));
902    if (json.has("highLimit"))
903      res.setHighLimit(parseQuantity(getJObject(json, "highLimit")));
904  }
905
906  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
907    Coding res = new Coding();
908    parseCodingProperties(json, res);
909    return res;
910  }
911
912  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
913    parseTypeProperties(json, res);
914    if (json.has("system"))
915      res.setSystemElement(parseUri(json.get("system").getAsString()));
916    if (json.has("_system"))
917      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
918    if (json.has("version"))
919      res.setVersionElement(parseString(json.get("version").getAsString()));
920    if (json.has("_version"))
921      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
922    if (json.has("code"))
923      res.setCodeElement(parseCode(json.get("code").getAsString()));
924    if (json.has("_code"))
925      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
926    if (json.has("display"))
927      res.setDisplayElement(parseString(json.get("display").getAsString()));
928    if (json.has("_display"))
929      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
930    if (json.has("userSelected"))
931      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
932    if (json.has("_userSelected"))
933      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
934  }
935
936  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
937    SampledData res = new SampledData();
938    parseSampledDataProperties(json, res);
939    return res;
940  }
941
942  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
943    parseTypeProperties(json, res);
944    if (json.has("origin"))
945      res.setOrigin(parseQuantity(getJObject(json, "origin")));
946    if (json.has("period"))
947      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
948    if (json.has("_period"))
949      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
950    if (json.has("factor"))
951      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
952    if (json.has("_factor"))
953      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
954    if (json.has("lowerLimit"))
955      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
956    if (json.has("_lowerLimit"))
957      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
958    if (json.has("upperLimit"))
959      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
960    if (json.has("_upperLimit"))
961      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
962    if (json.has("dimensions"))
963      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
964    if (json.has("_dimensions"))
965      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
966    if (json.has("data"))
967      res.setDataElement(parseString(json.get("data").getAsString()));
968    if (json.has("_data"))
969      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
970  }
971
972  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
973    Population res = new Population();
974    parsePopulationProperties(json, res);
975    return res;
976  }
977
978  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
979    parseBackboneElementProperties(json, res);
980    Type age = parseType("age", json);
981    if (age != null)
982      res.setAge(age);
983    if (json.has("gender"))
984      res.setGender(parseCodeableConcept(getJObject(json, "gender")));
985    if (json.has("race"))
986      res.setRace(parseCodeableConcept(getJObject(json, "race")));
987    if (json.has("physiologicalCondition"))
988      res.setPhysiologicalCondition(parseCodeableConcept(getJObject(json, "physiologicalCondition")));
989  }
990
991  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
992    Ratio res = new Ratio();
993    parseRatioProperties(json, res);
994    return res;
995  }
996
997  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
998    parseTypeProperties(json, res);
999    if (json.has("numerator"))
1000      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
1001    if (json.has("denominator"))
1002      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
1003  }
1004
1005  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
1006    Distance res = new Distance();
1007    parseDistanceProperties(json, res);
1008    return res;
1009  }
1010
1011  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
1012    parseQuantityProperties(json, res);
1013  }
1014
1015  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
1016    Age res = new Age();
1017    parseAgeProperties(json, res);
1018    return res;
1019  }
1020
1021  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
1022    parseQuantityProperties(json, res);
1023  }
1024
1025  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
1026    Reference res = new Reference();
1027    parseReferenceProperties(json, res);
1028    return res;
1029  }
1030
1031  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
1032    parseTypeProperties(json, res);
1033    if (json.has("reference"))
1034      res.setReferenceElement(parseString(json.get("reference").getAsString()));
1035    if (json.has("_reference"))
1036      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1037    if (json.has("type"))
1038      res.setTypeElement(parseUri(json.get("type").getAsString()));
1039    if (json.has("_type"))
1040      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1041    if (json.has("identifier"))
1042      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1043    if (json.has("display"))
1044      res.setDisplayElement(parseString(json.get("display").getAsString()));
1045    if (json.has("_display"))
1046      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1047  }
1048
1049  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
1050    TriggerDefinition res = new TriggerDefinition();
1051    parseTriggerDefinitionProperties(json, res);
1052    return res;
1053  }
1054
1055  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res)
1056      throws IOException, FHIRFormatError {
1057    parseTypeProperties(json, res);
1058    if (json.has("type"))
1059      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL,
1060          new TriggerDefinition.TriggerTypeEnumFactory()));
1061    if (json.has("_type"))
1062      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1063    if (json.has("name"))
1064      res.setNameElement(parseString(json.get("name").getAsString()));
1065    if (json.has("_name"))
1066      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1067    Type timing = parseType("timing", json);
1068    if (timing != null)
1069      res.setTiming(timing);
1070    if (json.has("data")) {
1071      JsonArray array = json.getAsJsonArray("data");
1072      for (int i = 0; i < array.size(); i++) {
1073        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
1074      }
1075    }
1076    ;
1077    if (json.has("condition"))
1078      res.setCondition(parseExpression(getJObject(json, "condition")));
1079  }
1080
1081  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1082    Quantity res = new Quantity();
1083    parseQuantityProperties(json, res);
1084    return res;
1085  }
1086
1087  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1088    parseTypeProperties(json, res);
1089    if (json.has("value"))
1090      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1091    if (json.has("_value"))
1092      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1093    if (json.has("comparator"))
1094      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL,
1095          new Quantity.QuantityComparatorEnumFactory()));
1096    if (json.has("_comparator"))
1097      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
1098    if (json.has("unit"))
1099      res.setUnitElement(parseString(json.get("unit").getAsString()));
1100    if (json.has("_unit"))
1101      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
1102    if (json.has("system"))
1103      res.setSystemElement(parseUri(json.get("system").getAsString()));
1104    if (json.has("_system"))
1105      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1106    if (json.has("code"))
1107      res.setCodeElement(parseCode(json.get("code").getAsString()));
1108    if (json.has("_code"))
1109      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1110  }
1111
1112  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1113    Period res = new Period();
1114    parsePeriodProperties(json, res);
1115    return res;
1116  }
1117
1118  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1119    parseTypeProperties(json, res);
1120    if (json.has("start"))
1121      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1122    if (json.has("_start"))
1123      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
1124    if (json.has("end"))
1125      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1126    if (json.has("_end"))
1127      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
1128  }
1129
1130  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
1131    Duration res = new Duration();
1132    parseDurationProperties(json, res);
1133    return res;
1134  }
1135
1136  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
1137    parseQuantityProperties(json, res);
1138  }
1139
1140  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1141    Range res = new Range();
1142    parseRangeProperties(json, res);
1143    return res;
1144  }
1145
1146  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1147    parseTypeProperties(json, res);
1148    if (json.has("low"))
1149      res.setLow(parseQuantity(getJObject(json, "low")));
1150    if (json.has("high"))
1151      res.setHigh(parseQuantity(getJObject(json, "high")));
1152  }
1153
1154  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1155    RelatedArtifact res = new RelatedArtifact();
1156    parseRelatedArtifactProperties(json, res);
1157    return res;
1158  }
1159
1160  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res)
1161      throws IOException, FHIRFormatError {
1162    parseTypeProperties(json, res);
1163    if (json.has("type"))
1164      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL,
1165          new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1166    if (json.has("_type"))
1167      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1168    if (json.has("label"))
1169      res.setLabelElement(parseString(json.get("label").getAsString()));
1170    if (json.has("_label"))
1171      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1172    if (json.has("display"))
1173      res.setDisplayElement(parseString(json.get("display").getAsString()));
1174    if (json.has("_display"))
1175      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1176    if (json.has("citation"))
1177      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1178    if (json.has("_citation"))
1179      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
1180    if (json.has("url"))
1181      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1182    if (json.has("_url"))
1183      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1184    if (json.has("document"))
1185      res.setDocument(parseAttachment(getJObject(json, "document")));
1186    if (json.has("resource"))
1187      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1188    if (json.has("_resource"))
1189      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
1190  }
1191
1192  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1193    Annotation res = new Annotation();
1194    parseAnnotationProperties(json, res);
1195    return res;
1196  }
1197
1198  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1199    parseTypeProperties(json, res);
1200    Type author = parseType("author", json);
1201    if (author != null)
1202      res.setAuthor(author);
1203    if (json.has("time"))
1204      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1205    if (json.has("_time"))
1206      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
1207    if (json.has("text"))
1208      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
1209    if (json.has("_text"))
1210      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1211  }
1212
1213  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1214    ProductShelfLife res = new ProductShelfLife();
1215    parseProductShelfLifeProperties(json, res);
1216    return res;
1217  }
1218
1219  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res)
1220      throws IOException, FHIRFormatError {
1221    parseBackboneElementProperties(json, res);
1222    if (json.has("identifier"))
1223      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1224    if (json.has("type"))
1225      res.setType(parseCodeableConcept(getJObject(json, "type")));
1226    if (json.has("period"))
1227      res.setPeriod(parseQuantity(getJObject(json, "period")));
1228    if (json.has("specialPrecautionsForStorage")) {
1229      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1230      for (int i = 0; i < array.size(); i++) {
1231        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1232      }
1233    }
1234    ;
1235  }
1236
1237  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1238    ContactDetail res = new ContactDetail();
1239    parseContactDetailProperties(json, res);
1240    return res;
1241  }
1242
1243  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1244    parseTypeProperties(json, res);
1245    if (json.has("name"))
1246      res.setNameElement(parseString(json.get("name").getAsString()));
1247    if (json.has("_name"))
1248      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1249    if (json.has("telecom")) {
1250      JsonArray array = json.getAsJsonArray("telecom");
1251      for (int i = 0; i < array.size(); i++) {
1252        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1253      }
1254    }
1255    ;
1256  }
1257
1258  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1259    UsageContext res = new UsageContext();
1260    parseUsageContextProperties(json, res);
1261    return res;
1262  }
1263
1264  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1265    parseTypeProperties(json, res);
1266    if (json.has("code"))
1267      res.setCode(parseCoding(getJObject(json, "code")));
1268    Type value = parseType("value", json);
1269    if (value != null)
1270      res.setValue(value);
1271  }
1272
1273  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1274    Expression res = new Expression();
1275    parseExpressionProperties(json, res);
1276    return res;
1277  }
1278
1279  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1280    parseElementProperties(json, res);
1281    if (json.has("description"))
1282      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1283    if (json.has("_description"))
1284      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1285    if (json.has("name"))
1286      res.setNameElement(parseId(json.get("name").getAsString()));
1287    if (json.has("_name"))
1288      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1289    if (json.has("language"))
1290      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1291    if (json.has("_language"))
1292      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1293    if (json.has("expression"))
1294      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1295    if (json.has("_expression"))
1296      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1297    if (json.has("reference"))
1298      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1299    if (json.has("_reference"))
1300      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1301  }
1302
1303  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1304    Signature res = new Signature();
1305    parseSignatureProperties(json, res);
1306    return res;
1307  }
1308
1309  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1310    parseTypeProperties(json, res);
1311    if (json.has("type")) {
1312      JsonArray array = json.getAsJsonArray("type");
1313      for (int i = 0; i < array.size(); i++) {
1314        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1315      }
1316    }
1317    ;
1318    if (json.has("when"))
1319      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1320    if (json.has("_when"))
1321      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
1322    if (json.has("who"))
1323      res.setWho(parseReference(getJObject(json, "who")));
1324    if (json.has("onBehalfOf"))
1325      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
1326    if (json.has("targetFormat"))
1327      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1328    if (json.has("_targetFormat"))
1329      parseElementProperties(getJObject(json, "_targetFormat"), res.getTargetFormatElement());
1330    if (json.has("sigFormat"))
1331      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1332    if (json.has("_sigFormat"))
1333      parseElementProperties(getJObject(json, "_sigFormat"), res.getSigFormatElement());
1334    if (json.has("data"))
1335      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1336    if (json.has("_data"))
1337      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1338  }
1339
1340  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1341    Timing res = new Timing();
1342    parseTimingProperties(json, res);
1343    return res;
1344  }
1345
1346  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1347    parseBackboneElementProperties(json, res);
1348    if (json.has("event")) {
1349      JsonArray array = json.getAsJsonArray("event");
1350      for (int i = 0; i < array.size(); i++) {
1351        if (array.get(i).isJsonNull()) {
1352          res.getEvent().add(new DateTimeType());
1353        } else {
1354          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1355        }
1356      }
1357    }
1358    ;
1359    if (json.has("_event")) {
1360      JsonArray array = json.getAsJsonArray("_event");
1361      for (int i = 0; i < array.size(); i++) {
1362        if (i == res.getEvent().size())
1363          res.getEvent().add(parseDateTime(null));
1364        if (array.get(i) instanceof JsonObject)
1365          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1366      }
1367    }
1368    ;
1369    if (json.has("repeat"))
1370      res.setRepeat(parseTimingTimingRepeatComponent(getJObject(json, "repeat"), res));
1371    if (json.has("code"))
1372      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1373  }
1374
1375  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner)
1376      throws IOException, FHIRFormatError {
1377    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1378    parseTimingTimingRepeatComponentProperties(json, owner, res);
1379    return res;
1380  }
1381
1382  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner,
1383      Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1384    parseTypeProperties(json, res);
1385    Type bounds = parseType("bounds", json);
1386    if (bounds != null)
1387      res.setBounds(bounds);
1388    if (json.has("count"))
1389      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1390    if (json.has("_count"))
1391      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1392    if (json.has("countMax"))
1393      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1394    if (json.has("_countMax"))
1395      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
1396    if (json.has("duration"))
1397      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1398    if (json.has("_duration"))
1399      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
1400    if (json.has("durationMax"))
1401      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1402    if (json.has("_durationMax"))
1403      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
1404    if (json.has("durationUnit"))
1405      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL,
1406          new Timing.UnitsOfTimeEnumFactory()));
1407    if (json.has("_durationUnit"))
1408      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
1409    if (json.has("frequency"))
1410      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1411    if (json.has("_frequency"))
1412      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
1413    if (json.has("frequencyMax"))
1414      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1415    if (json.has("_frequencyMax"))
1416      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
1417    if (json.has("period"))
1418      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1419    if (json.has("_period"))
1420      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1421    if (json.has("periodMax"))
1422      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1423    if (json.has("_periodMax"))
1424      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
1425    if (json.has("periodUnit"))
1426      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL,
1427          new Timing.UnitsOfTimeEnumFactory()));
1428    if (json.has("_periodUnit"))
1429      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
1430    if (json.has("dayOfWeek")) {
1431      JsonArray array = json.getAsJsonArray("dayOfWeek");
1432      for (int i = 0; i < array.size(); i++) {
1433        if (array.get(i).isJsonNull()) {
1434          res.getDayOfWeek().add(new Enumeration<Timing.DayOfWeek>());
1435        } else {
1436          res.getDayOfWeek().add(
1437              parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1438        }
1439      }
1440    }
1441    ;
1442    if (json.has("_dayOfWeek")) {
1443      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1444      for (int i = 0; i < array.size(); i++) {
1445        if (i == res.getDayOfWeek().size())
1446          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1447        if (array.get(i) instanceof JsonObject)
1448          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1449      }
1450    }
1451    ;
1452    if (json.has("timeOfDay")) {
1453      JsonArray array = json.getAsJsonArray("timeOfDay");
1454      for (int i = 0; i < array.size(); i++) {
1455        if (array.get(i).isJsonNull()) {
1456          res.getTimeOfDay().add(new TimeType());
1457        } else {
1458          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1459        }
1460      }
1461    }
1462    ;
1463    if (json.has("_timeOfDay")) {
1464      JsonArray array = json.getAsJsonArray("_timeOfDay");
1465      for (int i = 0; i < array.size(); i++) {
1466        if (i == res.getTimeOfDay().size())
1467          res.getTimeOfDay().add(parseTime(null));
1468        if (array.get(i) instanceof JsonObject)
1469          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1470      }
1471    }
1472    ;
1473    if (json.has("when")) {
1474      JsonArray array = json.getAsJsonArray("when");
1475      for (int i = 0; i < array.size(); i++) {
1476        if (array.get(i).isJsonNull()) {
1477          res.getWhen().add(new Enumeration<Timing.EventTiming>());
1478        } else {
1479          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL,
1480              new Timing.EventTimingEnumFactory()));
1481        }
1482      }
1483    }
1484    ;
1485    if (json.has("_when")) {
1486      JsonArray array = json.getAsJsonArray("_when");
1487      for (int i = 0; i < array.size(); i++) {
1488        if (i == res.getWhen().size())
1489          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1490        if (array.get(i) instanceof JsonObject)
1491          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1492      }
1493    }
1494    ;
1495    if (json.has("offset"))
1496      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1497    if (json.has("_offset"))
1498      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
1499  }
1500
1501  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1502    ProdCharacteristic res = new ProdCharacteristic();
1503    parseProdCharacteristicProperties(json, res);
1504    return res;
1505  }
1506
1507  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res)
1508      throws IOException, FHIRFormatError {
1509    parseBackboneElementProperties(json, res);
1510    if (json.has("height"))
1511      res.setHeight(parseQuantity(getJObject(json, "height")));
1512    if (json.has("width"))
1513      res.setWidth(parseQuantity(getJObject(json, "width")));
1514    if (json.has("depth"))
1515      res.setDepth(parseQuantity(getJObject(json, "depth")));
1516    if (json.has("weight"))
1517      res.setWeight(parseQuantity(getJObject(json, "weight")));
1518    if (json.has("nominalVolume"))
1519      res.setNominalVolume(parseQuantity(getJObject(json, "nominalVolume")));
1520    if (json.has("externalDiameter"))
1521      res.setExternalDiameter(parseQuantity(getJObject(json, "externalDiameter")));
1522    if (json.has("shape"))
1523      res.setShapeElement(parseString(json.get("shape").getAsString()));
1524    if (json.has("_shape"))
1525      parseElementProperties(getJObject(json, "_shape"), res.getShapeElement());
1526    if (json.has("color")) {
1527      JsonArray array = json.getAsJsonArray("color");
1528      for (int i = 0; i < array.size(); i++) {
1529        if (array.get(i).isJsonNull()) {
1530          res.getColor().add(new StringType());
1531        } else {
1532          res.getColor().add(parseString(array.get(i).getAsString()));
1533        }
1534      }
1535    }
1536    ;
1537    if (json.has("_color")) {
1538      JsonArray array = json.getAsJsonArray("_color");
1539      for (int i = 0; i < array.size(); i++) {
1540        if (i == res.getColor().size())
1541          res.getColor().add(parseString(null));
1542        if (array.get(i) instanceof JsonObject)
1543          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1544      }
1545    }
1546    ;
1547    if (json.has("imprint")) {
1548      JsonArray array = json.getAsJsonArray("imprint");
1549      for (int i = 0; i < array.size(); i++) {
1550        if (array.get(i).isJsonNull()) {
1551          res.getImprint().add(new StringType());
1552        } else {
1553          res.getImprint().add(parseString(array.get(i).getAsString()));
1554        }
1555      }
1556    }
1557    ;
1558    if (json.has("_imprint")) {
1559      JsonArray array = json.getAsJsonArray("_imprint");
1560      for (int i = 0; i < array.size(); i++) {
1561        if (i == res.getImprint().size())
1562          res.getImprint().add(parseString(null));
1563        if (array.get(i) instanceof JsonObject)
1564          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1565      }
1566    }
1567    ;
1568    if (json.has("image")) {
1569      JsonArray array = json.getAsJsonArray("image");
1570      for (int i = 0; i < array.size(); i++) {
1571        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1572      }
1573    }
1574    ;
1575    if (json.has("scoring"))
1576      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
1577  }
1578
1579  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1580    CodeableConcept res = new CodeableConcept();
1581    parseCodeableConceptProperties(json, res);
1582    return res;
1583  }
1584
1585  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res)
1586      throws IOException, FHIRFormatError {
1587    parseTypeProperties(json, res);
1588    if (json.has("coding")) {
1589      JsonArray array = json.getAsJsonArray("coding");
1590      for (int i = 0; i < array.size(); i++) {
1591        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1592      }
1593    }
1594    ;
1595    if (json.has("text"))
1596      res.setTextElement(parseString(json.get("text").getAsString()));
1597    if (json.has("_text"))
1598      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1599  }
1600
1601  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1602    ParameterDefinition res = new ParameterDefinition();
1603    parseParameterDefinitionProperties(json, res);
1604    return res;
1605  }
1606
1607  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res)
1608      throws IOException, FHIRFormatError {
1609    parseTypeProperties(json, res);
1610    if (json.has("name"))
1611      res.setNameElement(parseCode(json.get("name").getAsString()));
1612    if (json.has("_name"))
1613      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1614    if (json.has("use"))
1615      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL,
1616          new ParameterDefinition.ParameterUseEnumFactory()));
1617    if (json.has("_use"))
1618      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1619    if (json.has("min"))
1620      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1621    if (json.has("_min"))
1622      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1623    if (json.has("max"))
1624      res.setMaxElement(parseString(json.get("max").getAsString()));
1625    if (json.has("_max"))
1626      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1627    if (json.has("documentation"))
1628      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1629    if (json.has("_documentation"))
1630      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1631    if (json.has("type"))
1632      res.setTypeElement(parseCode(json.get("type").getAsString()));
1633    if (json.has("_type"))
1634      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1635    if (json.has("profile"))
1636      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1637    if (json.has("_profile"))
1638      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1639  }
1640
1641  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1642    ElementDefinition res = new ElementDefinition();
1643    parseElementDefinitionProperties(json, res);
1644    return res;
1645  }
1646
1647  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res)
1648      throws IOException, FHIRFormatError {
1649    parseBackboneElementProperties(json, res);
1650    if (json.has("path"))
1651      res.setPathElement(parseString(json.get("path").getAsString()));
1652    if (json.has("_path"))
1653      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1654    if (json.has("representation")) {
1655      JsonArray array = json.getAsJsonArray("representation");
1656      for (int i = 0; i < array.size(); i++) {
1657        if (array.get(i).isJsonNull()) {
1658          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>());
1659        } else {
1660          res.getRepresentation()
1661              .add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL,
1662                  new ElementDefinition.PropertyRepresentationEnumFactory()));
1663        }
1664      }
1665    }
1666    ;
1667    if (json.has("_representation")) {
1668      JsonArray array = json.getAsJsonArray("_representation");
1669      for (int i = 0; i < array.size(); i++) {
1670        if (i == res.getRepresentation().size())
1671          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL,
1672              new ElementDefinition.PropertyRepresentationEnumFactory()));
1673        if (array.get(i) instanceof JsonObject)
1674          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1675      }
1676    }
1677    ;
1678    if (json.has("sliceName"))
1679      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1680    if (json.has("_sliceName"))
1681      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
1682    if (json.has("sliceIsConstraining"))
1683      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
1684    if (json.has("_sliceIsConstraining"))
1685      parseElementProperties(getJObject(json, "_sliceIsConstraining"), res.getSliceIsConstrainingElement());
1686    if (json.has("label"))
1687      res.setLabelElement(parseString(json.get("label").getAsString()));
1688    if (json.has("_label"))
1689      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1690    if (json.has("code")) {
1691      JsonArray array = json.getAsJsonArray("code");
1692      for (int i = 0; i < array.size(); i++) {
1693        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1694      }
1695    }
1696    ;
1697    if (json.has("slicing"))
1698      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(getJObject(json, "slicing"), res));
1699    if (json.has("short"))
1700      res.setShortElement(parseString(json.get("short").getAsString()));
1701    if (json.has("_short"))
1702      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
1703    if (json.has("definition"))
1704      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1705    if (json.has("_definition"))
1706      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
1707    if (json.has("comment"))
1708      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1709    if (json.has("_comment"))
1710      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1711    if (json.has("requirements"))
1712      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1713    if (json.has("_requirements"))
1714      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1715    if (json.has("alias")) {
1716      JsonArray array = json.getAsJsonArray("alias");
1717      for (int i = 0; i < array.size(); i++) {
1718        if (array.get(i).isJsonNull()) {
1719          res.getAlias().add(new StringType());
1720        } else {
1721          res.getAlias().add(parseString(array.get(i).getAsString()));
1722        }
1723      }
1724    }
1725    ;
1726    if (json.has("_alias")) {
1727      JsonArray array = json.getAsJsonArray("_alias");
1728      for (int i = 0; i < array.size(); i++) {
1729        if (i == res.getAlias().size())
1730          res.getAlias().add(parseString(null));
1731        if (array.get(i) instanceof JsonObject)
1732          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1733      }
1734    }
1735    ;
1736    if (json.has("min"))
1737      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1738    if (json.has("_min"))
1739      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1740    if (json.has("max"))
1741      res.setMaxElement(parseString(json.get("max").getAsString()));
1742    if (json.has("_max"))
1743      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1744    if (json.has("base"))
1745      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(getJObject(json, "base"), res));
1746    if (json.has("contentReference"))
1747      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1748    if (json.has("_contentReference"))
1749      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
1750    if (json.has("type")) {
1751      JsonArray array = json.getAsJsonArray("type");
1752      for (int i = 0; i < array.size(); i++) {
1753        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1754      }
1755    }
1756    ;
1757    Type defaultValue = parseType("defaultValue", json);
1758    if (defaultValue != null)
1759      res.setDefaultValue(defaultValue);
1760    if (json.has("meaningWhenMissing"))
1761      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1762    if (json.has("_meaningWhenMissing"))
1763      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1764    if (json.has("orderMeaning"))
1765      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1766    if (json.has("_orderMeaning"))
1767      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
1768    Type fixed = parseType("fixed", json);
1769    if (fixed != null)
1770      res.setFixed(fixed);
1771    Type pattern = parseType("pattern", json);
1772    if (pattern != null)
1773      res.setPattern(pattern);
1774    if (json.has("example")) {
1775      JsonArray array = json.getAsJsonArray("example");
1776      for (int i = 0; i < array.size(); i++) {
1777        res.getExample()
1778            .add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1779      }
1780    }
1781    ;
1782    Type minValue = parseType("minValue", json);
1783    if (minValue != null)
1784      res.setMinValue(minValue);
1785    Type maxValue = parseType("maxValue", json);
1786    if (maxValue != null)
1787      res.setMaxValue(maxValue);
1788    if (json.has("maxLength"))
1789      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1790    if (json.has("_maxLength"))
1791      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
1792    if (json.has("condition")) {
1793      JsonArray array = json.getAsJsonArray("condition");
1794      for (int i = 0; i < array.size(); i++) {
1795        if (array.get(i).isJsonNull()) {
1796          res.getCondition().add(new IdType());
1797        } else {
1798          res.getCondition().add(parseId(array.get(i).getAsString()));
1799        }
1800      }
1801    }
1802    ;
1803    if (json.has("_condition")) {
1804      JsonArray array = json.getAsJsonArray("_condition");
1805      for (int i = 0; i < array.size(); i++) {
1806        if (i == res.getCondition().size())
1807          res.getCondition().add(parseId(null));
1808        if (array.get(i) instanceof JsonObject)
1809          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1810      }
1811    }
1812    ;
1813    if (json.has("constraint")) {
1814      JsonArray array = json.getAsJsonArray("constraint");
1815      for (int i = 0; i < array.size(); i++) {
1816        res.getConstraint()
1817            .add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1818      }
1819    }
1820    ;
1821    if (json.has("mustSupport"))
1822      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1823    if (json.has("_mustSupport"))
1824      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
1825    if (json.has("isModifier"))
1826      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1827    if (json.has("_isModifier"))
1828      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
1829    if (json.has("isModifierReason"))
1830      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1831    if (json.has("_isModifierReason"))
1832      parseElementProperties(getJObject(json, "_isModifierReason"), res.getIsModifierReasonElement());
1833    if (json.has("isSummary"))
1834      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1835    if (json.has("_isSummary"))
1836      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
1837    if (json.has("binding"))
1838      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(getJObject(json, "binding"), res));
1839    if (json.has("mapping")) {
1840      JsonArray array = json.getAsJsonArray("mapping");
1841      for (int i = 0; i < array.size(); i++) {
1842        res.getMapping()
1843            .add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1844      }
1845    }
1846    ;
1847  }
1848
1849  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(
1850      JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1851    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1852    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1853    return res;
1854  }
1855
1856  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json,
1857      ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res)
1858      throws IOException, FHIRFormatError {
1859    parseTypeProperties(json, res);
1860    if (json.has("discriminator")) {
1861      JsonArray array = json.getAsJsonArray("discriminator");
1862      for (int i = 0; i < array.size(); i++) {
1863        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(
1864            array.get(i).getAsJsonObject(), owner));
1865      }
1866    }
1867    ;
1868    if (json.has("description"))
1869      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1870    if (json.has("_description"))
1871      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1872    if (json.has("ordered"))
1873      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1874    if (json.has("_ordered"))
1875      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
1876    if (json.has("rules"))
1877      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL,
1878          new ElementDefinition.SlicingRulesEnumFactory()));
1879    if (json.has("_rules"))
1880      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
1881  }
1882
1883  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(
1884      JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1885    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1886    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1887    return res;
1888  }
1889
1890  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json,
1891      ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res)
1892      throws IOException, FHIRFormatError {
1893    parseTypeProperties(json, res);
1894    if (json.has("type"))
1895      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL,
1896          new ElementDefinition.DiscriminatorTypeEnumFactory()));
1897    if (json.has("_type"))
1898      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1899    if (json.has("path"))
1900      res.setPathElement(parseString(json.get("path").getAsString()));
1901    if (json.has("_path"))
1902      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1903  }
1904
1905  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(
1906      JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1907    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1908    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1909    return res;
1910  }
1911
1912  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json,
1913      ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res)
1914      throws IOException, FHIRFormatError {
1915    parseTypeProperties(json, res);
1916    if (json.has("path"))
1917      res.setPathElement(parseString(json.get("path").getAsString()));
1918    if (json.has("_path"))
1919      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1920    if (json.has("min"))
1921      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1922    if (json.has("_min"))
1923      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1924    if (json.has("max"))
1925      res.setMaxElement(parseString(json.get("max").getAsString()));
1926    if (json.has("_max"))
1927      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1928  }
1929
1930  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json,
1931      ElementDefinition owner) throws IOException, FHIRFormatError {
1932    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1933    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1934    return res;
1935  }
1936
1937  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner,
1938      ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1939    parseTypeProperties(json, res);
1940    if (json.has("code"))
1941      res.setCodeElement(parseUri(json.get("code").getAsString()));
1942    if (json.has("_code"))
1943      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1944    if (json.has("profile")) {
1945      JsonArray array = json.getAsJsonArray("profile");
1946      for (int i = 0; i < array.size(); i++) {
1947        if (array.get(i).isJsonNull()) {
1948          res.getProfile().add(new CanonicalType());
1949        } else {
1950          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1951        }
1952      }
1953    }
1954    ;
1955    if (json.has("_profile")) {
1956      JsonArray array = json.getAsJsonArray("_profile");
1957      for (int i = 0; i < array.size(); i++) {
1958        if (i == res.getProfile().size())
1959          res.getProfile().add(parseCanonical(null));
1960        if (array.get(i) instanceof JsonObject)
1961          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1962      }
1963    }
1964    ;
1965    if (json.has("targetProfile")) {
1966      JsonArray array = json.getAsJsonArray("targetProfile");
1967      for (int i = 0; i < array.size(); i++) {
1968        if (array.get(i).isJsonNull()) {
1969          res.getTargetProfile().add(new CanonicalType());
1970        } else {
1971          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1972        }
1973      }
1974    }
1975    ;
1976    if (json.has("_targetProfile")) {
1977      JsonArray array = json.getAsJsonArray("_targetProfile");
1978      for (int i = 0; i < array.size(); i++) {
1979        if (i == res.getTargetProfile().size())
1980          res.getTargetProfile().add(parseCanonical(null));
1981        if (array.get(i) instanceof JsonObject)
1982          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1983      }
1984    }
1985    ;
1986    if (json.has("aggregation")) {
1987      JsonArray array = json.getAsJsonArray("aggregation");
1988      for (int i = 0; i < array.size(); i++) {
1989        if (array.get(i).isJsonNull()) {
1990          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>());
1991        } else {
1992          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL,
1993              new ElementDefinition.AggregationModeEnumFactory()));
1994        }
1995      }
1996    }
1997    ;
1998    if (json.has("_aggregation")) {
1999      JsonArray array = json.getAsJsonArray("_aggregation");
2000      for (int i = 0; i < array.size(); i++) {
2001        if (i == res.getAggregation().size())
2002          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL,
2003              new ElementDefinition.AggregationModeEnumFactory()));
2004        if (array.get(i) instanceof JsonObject)
2005          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
2006      }
2007    }
2008    ;
2009    if (json.has("versioning"))
2010      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(),
2011          ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
2012    if (json.has("_versioning"))
2013      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
2014  }
2015
2016  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(
2017      JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2018    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
2019    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
2020    return res;
2021  }
2022
2023  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json,
2024      ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res)
2025      throws IOException, FHIRFormatError {
2026    parseTypeProperties(json, res);
2027    if (json.has("label"))
2028      res.setLabelElement(parseString(json.get("label").getAsString()));
2029    if (json.has("_label"))
2030      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
2031    Type value = parseType("value", json);
2032    if (value != null)
2033      res.setValue(value);
2034  }
2035
2036  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(
2037      JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2038    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
2039    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
2040    return res;
2041  }
2042
2043  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json,
2044      ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res)
2045      throws IOException, FHIRFormatError {
2046    parseTypeProperties(json, res);
2047    if (json.has("key"))
2048      res.setKeyElement(parseId(json.get("key").getAsString()));
2049    if (json.has("_key"))
2050      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
2051    if (json.has("requirements"))
2052      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
2053    if (json.has("_requirements"))
2054      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
2055    if (json.has("severity"))
2056      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(),
2057          ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
2058    if (json.has("_severity"))
2059      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2060    if (json.has("human"))
2061      res.setHumanElement(parseString(json.get("human").getAsString()));
2062    if (json.has("_human"))
2063      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
2064    if (json.has("expression"))
2065      res.setExpressionElement(parseString(json.get("expression").getAsString()));
2066    if (json.has("_expression"))
2067      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
2068    if (json.has("xpath"))
2069      res.setXpathElement(parseString(json.get("xpath").getAsString()));
2070    if (json.has("_xpath"))
2071      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
2072    if (json.has("source"))
2073      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
2074    if (json.has("_source"))
2075      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
2076  }
2077
2078  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(
2079      JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2080    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
2081    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
2082    return res;
2083  }
2084
2085  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json,
2086      ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res)
2087      throws IOException, FHIRFormatError {
2088    parseTypeProperties(json, res);
2089    if (json.has("strength"))
2090      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL,
2091          new Enumerations.BindingStrengthEnumFactory()));
2092    if (json.has("_strength"))
2093      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
2094    if (json.has("description"))
2095      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2096    if (json.has("_description"))
2097      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2098    if (json.has("valueSet"))
2099      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
2100    if (json.has("_valueSet"))
2101      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
2102  }
2103
2104  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(
2105      JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2106    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
2107    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
2108    return res;
2109  }
2110
2111  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json,
2112      ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res)
2113      throws IOException, FHIRFormatError {
2114    parseTypeProperties(json, res);
2115    if (json.has("identity"))
2116      res.setIdentityElement(parseId(json.get("identity").getAsString()));
2117    if (json.has("_identity"))
2118      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
2119    if (json.has("language"))
2120      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2121    if (json.has("_language"))
2122      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2123    if (json.has("map"))
2124      res.setMapElement(parseString(json.get("map").getAsString()));
2125    if (json.has("_map"))
2126      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
2127    if (json.has("comment"))
2128      res.setCommentElement(parseString(json.get("comment").getAsString()));
2129    if (json.has("_comment"))
2130      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2131  }
2132
2133  protected void parseDomainResourceProperties(JsonObject json, DomainResource res)
2134      throws IOException, FHIRFormatError {
2135    parseResourceProperties(json, res);
2136    if (json.has("text"))
2137      res.setText(parseNarrative(getJObject(json, "text")));
2138    if (json.has("contained")) {
2139      JsonArray array = json.getAsJsonArray("contained");
2140      for (int i = 0; i < array.size(); i++) {
2141        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
2142      }
2143    }
2144    ;
2145    if (json.has("extension")) {
2146      JsonArray array = json.getAsJsonArray("extension");
2147      for (int i = 0; i < array.size(); i++) {
2148        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2149      }
2150    }
2151    ;
2152    if (json.has("modifierExtension")) {
2153      JsonArray array = json.getAsJsonArray("modifierExtension");
2154      for (int i = 0; i < array.size(); i++) {
2155        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2156      }
2157    }
2158    ;
2159  }
2160
2161  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
2162    Parameters res = new Parameters();
2163    parseParametersProperties(json, res);
2164    return res;
2165  }
2166
2167  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
2168    parseResourceProperties(json, res);
2169    if (json.has("parameter")) {
2170      JsonArray array = json.getAsJsonArray("parameter");
2171      for (int i = 0; i < array.size(); i++) {
2172        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
2173      }
2174    }
2175    ;
2176  }
2177
2178  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json,
2179      Parameters owner) throws IOException, FHIRFormatError {
2180    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
2181    parseParametersParametersParameterComponentProperties(json, owner, res);
2182    return res;
2183  }
2184
2185  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner,
2186      Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
2187    parseBackboneElementProperties(json, res);
2188    if (json.has("name"))
2189      res.setNameElement(parseString(json.get("name").getAsString()));
2190    if (json.has("_name"))
2191      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2192    Type value = parseType("value", json);
2193    if (value != null)
2194      res.setValue(value);
2195    if (json.has("resource"))
2196      res.setResource(parseResource(getJObject(json, "resource")));
2197    if (json.has("part")) {
2198      JsonArray array = json.getAsJsonArray("part");
2199      for (int i = 0; i < array.size(); i++) {
2200        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
2201      }
2202    }
2203    ;
2204  }
2205
2206  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
2207    if (json.has("id"))
2208      res.setIdElement(parseId(json.get("id").getAsString()));
2209    if (json.has("_id"))
2210      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
2211    if (json.has("meta"))
2212      res.setMeta(parseMeta(getJObject(json, "meta")));
2213    if (json.has("implicitRules"))
2214      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2215    if (json.has("_implicitRules"))
2216      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
2217    if (json.has("language"))
2218      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2219    if (json.has("_language"))
2220      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2221  }
2222
2223  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2224    Account res = new Account();
2225    parseAccountProperties(json, res);
2226    return res;
2227  }
2228
2229  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2230    parseDomainResourceProperties(json, res);
2231    if (json.has("identifier")) {
2232      JsonArray array = json.getAsJsonArray("identifier");
2233      for (int i = 0; i < array.size(); i++) {
2234        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2235      }
2236    }
2237    ;
2238    if (json.has("status"))
2239      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL,
2240          new Account.AccountStatusEnumFactory()));
2241    if (json.has("_status"))
2242      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2243    if (json.has("type"))
2244      res.setType(parseCodeableConcept(getJObject(json, "type")));
2245    if (json.has("name"))
2246      res.setNameElement(parseString(json.get("name").getAsString()));
2247    if (json.has("_name"))
2248      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2249    if (json.has("subject")) {
2250      JsonArray array = json.getAsJsonArray("subject");
2251      for (int i = 0; i < array.size(); i++) {
2252        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2253      }
2254    }
2255    ;
2256    if (json.has("servicePeriod"))
2257      res.setServicePeriod(parsePeriod(getJObject(json, "servicePeriod")));
2258    if (json.has("coverage")) {
2259      JsonArray array = json.getAsJsonArray("coverage");
2260      for (int i = 0; i < array.size(); i++) {
2261        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2262      }
2263    }
2264    ;
2265    if (json.has("owner"))
2266      res.setOwner(parseReference(getJObject(json, "owner")));
2267    if (json.has("description"))
2268      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2269    if (json.has("_description"))
2270      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2271    if (json.has("guarantor")) {
2272      JsonArray array = json.getAsJsonArray("guarantor");
2273      for (int i = 0; i < array.size(); i++) {
2274        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2275      }
2276    }
2277    ;
2278    if (json.has("partOf"))
2279      res.setPartOf(parseReference(getJObject(json, "partOf")));
2280  }
2281
2282  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner)
2283      throws IOException, FHIRFormatError {
2284    Account.CoverageComponent res = new Account.CoverageComponent();
2285    parseAccountCoverageComponentProperties(json, owner, res);
2286    return res;
2287  }
2288
2289  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res)
2290      throws IOException, FHIRFormatError {
2291    parseBackboneElementProperties(json, res);
2292    if (json.has("coverage"))
2293      res.setCoverage(parseReference(getJObject(json, "coverage")));
2294    if (json.has("priority"))
2295      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2296    if (json.has("_priority"))
2297      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2298  }
2299
2300  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner)
2301      throws IOException, FHIRFormatError {
2302    Account.GuarantorComponent res = new Account.GuarantorComponent();
2303    parseAccountGuarantorComponentProperties(json, owner, res);
2304    return res;
2305  }
2306
2307  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner,
2308      Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2309    parseBackboneElementProperties(json, res);
2310    if (json.has("party"))
2311      res.setParty(parseReference(getJObject(json, "party")));
2312    if (json.has("onHold"))
2313      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2314    if (json.has("_onHold"))
2315      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
2316    if (json.has("period"))
2317      res.setPeriod(parsePeriod(getJObject(json, "period")));
2318  }
2319
2320  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2321    ActivityDefinition res = new ActivityDefinition();
2322    parseActivityDefinitionProperties(json, res);
2323    return res;
2324  }
2325
2326  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res)
2327      throws IOException, FHIRFormatError {
2328    parseDomainResourceProperties(json, res);
2329    if (json.has("url"))
2330      res.setUrlElement(parseUri(json.get("url").getAsString()));
2331    if (json.has("_url"))
2332      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2333    if (json.has("identifier")) {
2334      JsonArray array = json.getAsJsonArray("identifier");
2335      for (int i = 0; i < array.size(); i++) {
2336        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2337      }
2338    }
2339    ;
2340    if (json.has("version"))
2341      res.setVersionElement(parseString(json.get("version").getAsString()));
2342    if (json.has("_version"))
2343      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2344    if (json.has("name"))
2345      res.setNameElement(parseString(json.get("name").getAsString()));
2346    if (json.has("_name"))
2347      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2348    if (json.has("title"))
2349      res.setTitleElement(parseString(json.get("title").getAsString()));
2350    if (json.has("_title"))
2351      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2352    if (json.has("subtitle"))
2353      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2354    if (json.has("_subtitle"))
2355      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
2356    if (json.has("status"))
2357      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
2358          new Enumerations.PublicationStatusEnumFactory()));
2359    if (json.has("_status"))
2360      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2361    if (json.has("experimental"))
2362      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2363    if (json.has("_experimental"))
2364      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2365    Type subject = parseType("subject", json);
2366    if (subject != null)
2367      res.setSubject(subject);
2368    if (json.has("date"))
2369      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2370    if (json.has("_date"))
2371      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2372    if (json.has("publisher"))
2373      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2374    if (json.has("_publisher"))
2375      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2376    if (json.has("contact")) {
2377      JsonArray array = json.getAsJsonArray("contact");
2378      for (int i = 0; i < array.size(); i++) {
2379        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2380      }
2381    }
2382    ;
2383    if (json.has("description"))
2384      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2385    if (json.has("_description"))
2386      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2387    if (json.has("useContext")) {
2388      JsonArray array = json.getAsJsonArray("useContext");
2389      for (int i = 0; i < array.size(); i++) {
2390        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2391      }
2392    }
2393    ;
2394    if (json.has("jurisdiction")) {
2395      JsonArray array = json.getAsJsonArray("jurisdiction");
2396      for (int i = 0; i < array.size(); i++) {
2397        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2398      }
2399    }
2400    ;
2401    if (json.has("purpose"))
2402      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2403    if (json.has("_purpose"))
2404      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2405    if (json.has("usage"))
2406      res.setUsageElement(parseString(json.get("usage").getAsString()));
2407    if (json.has("_usage"))
2408      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
2409    if (json.has("copyright"))
2410      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2411    if (json.has("_copyright"))
2412      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2413    if (json.has("approvalDate"))
2414      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2415    if (json.has("_approvalDate"))
2416      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
2417    if (json.has("lastReviewDate"))
2418      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2419    if (json.has("_lastReviewDate"))
2420      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
2421    if (json.has("effectivePeriod"))
2422      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
2423    if (json.has("topic")) {
2424      JsonArray array = json.getAsJsonArray("topic");
2425      for (int i = 0; i < array.size(); i++) {
2426        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2427      }
2428    }
2429    ;
2430    if (json.has("author")) {
2431      JsonArray array = json.getAsJsonArray("author");
2432      for (int i = 0; i < array.size(); i++) {
2433        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2434      }
2435    }
2436    ;
2437    if (json.has("editor")) {
2438      JsonArray array = json.getAsJsonArray("editor");
2439      for (int i = 0; i < array.size(); i++) {
2440        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2441      }
2442    }
2443    ;
2444    if (json.has("reviewer")) {
2445      JsonArray array = json.getAsJsonArray("reviewer");
2446      for (int i = 0; i < array.size(); i++) {
2447        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2448      }
2449    }
2450    ;
2451    if (json.has("endorser")) {
2452      JsonArray array = json.getAsJsonArray("endorser");
2453      for (int i = 0; i < array.size(); i++) {
2454        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2455      }
2456    }
2457    ;
2458    if (json.has("relatedArtifact")) {
2459      JsonArray array = json.getAsJsonArray("relatedArtifact");
2460      for (int i = 0; i < array.size(); i++) {
2461        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2462      }
2463    }
2464    ;
2465    if (json.has("library")) {
2466      JsonArray array = json.getAsJsonArray("library");
2467      for (int i = 0; i < array.size(); i++) {
2468        if (array.get(i).isJsonNull()) {
2469          res.getLibrary().add(new CanonicalType());
2470        } else {
2471          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2472        }
2473      }
2474    }
2475    ;
2476    if (json.has("_library")) {
2477      JsonArray array = json.getAsJsonArray("_library");
2478      for (int i = 0; i < array.size(); i++) {
2479        if (i == res.getLibrary().size())
2480          res.getLibrary().add(parseCanonical(null));
2481        if (array.get(i) instanceof JsonObject)
2482          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2483      }
2484    }
2485    ;
2486    if (json.has("kind"))
2487      res.setKindElement(parseEnumeration(json.get("kind").getAsString(),
2488          ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2489    if (json.has("_kind"))
2490      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2491    if (json.has("profile"))
2492      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2493    if (json.has("_profile"))
2494      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
2495    if (json.has("code"))
2496      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2497    if (json.has("intent"))
2498      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ActivityDefinition.RequestIntent.NULL,
2499          new ActivityDefinition.RequestIntentEnumFactory()));
2500    if (json.has("_intent"))
2501      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
2502    if (json.has("priority"))
2503      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(),
2504          ActivityDefinition.RequestPriority.NULL, new ActivityDefinition.RequestPriorityEnumFactory()));
2505    if (json.has("_priority"))
2506      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2507    if (json.has("doNotPerform"))
2508      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2509    if (json.has("_doNotPerform"))
2510      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
2511    Type timing = parseType("timing", json);
2512    if (timing != null)
2513      res.setTiming(timing);
2514    if (json.has("location"))
2515      res.setLocation(parseReference(getJObject(json, "location")));
2516    if (json.has("participant")) {
2517      JsonArray array = json.getAsJsonArray("participant");
2518      for (int i = 0; i < array.size(); i++) {
2519        res.getParticipant()
2520            .add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2521      }
2522    }
2523    ;
2524    Type product = parseType("product", json);
2525    if (product != null)
2526      res.setProduct(product);
2527    if (json.has("quantity"))
2528      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
2529    if (json.has("dosage")) {
2530      JsonArray array = json.getAsJsonArray("dosage");
2531      for (int i = 0; i < array.size(); i++) {
2532        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2533      }
2534    }
2535    ;
2536    if (json.has("bodySite")) {
2537      JsonArray array = json.getAsJsonArray("bodySite");
2538      for (int i = 0; i < array.size(); i++) {
2539        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2540      }
2541    }
2542    ;
2543    if (json.has("specimenRequirement")) {
2544      JsonArray array = json.getAsJsonArray("specimenRequirement");
2545      for (int i = 0; i < array.size(); i++) {
2546        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2547      }
2548    }
2549    ;
2550    if (json.has("observationRequirement")) {
2551      JsonArray array = json.getAsJsonArray("observationRequirement");
2552      for (int i = 0; i < array.size(); i++) {
2553        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2554      }
2555    }
2556    ;
2557    if (json.has("observationResultRequirement")) {
2558      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2559      for (int i = 0; i < array.size(); i++) {
2560        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2561      }
2562    }
2563    ;
2564    if (json.has("transform"))
2565      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2566    if (json.has("_transform"))
2567      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
2568    if (json.has("dynamicValue")) {
2569      JsonArray array = json.getAsJsonArray("dynamicValue");
2570      for (int i = 0; i < array.size(); i++) {
2571        res.getDynamicValue()
2572            .add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2573      }
2574    }
2575    ;
2576  }
2577
2578  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(
2579      JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2580    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2581    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2582    return res;
2583  }
2584
2585  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json,
2586      ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res)
2587      throws IOException, FHIRFormatError {
2588    parseBackboneElementProperties(json, res);
2589    if (json.has("type"))
2590      res.setTypeElement(
2591          parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL,
2592              new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2593    if (json.has("_type"))
2594      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2595    if (json.has("role"))
2596      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2597  }
2598
2599  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(
2600      JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2601    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2602    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2603    return res;
2604  }
2605
2606  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json,
2607      ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res)
2608      throws IOException, FHIRFormatError {
2609    parseBackboneElementProperties(json, res);
2610    if (json.has("path"))
2611      res.setPathElement(parseString(json.get("path").getAsString()));
2612    if (json.has("_path"))
2613      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2614    if (json.has("expression"))
2615      res.setExpression(parseExpression(getJObject(json, "expression")));
2616  }
2617
2618  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2619    AdverseEvent res = new AdverseEvent();
2620    parseAdverseEventProperties(json, res);
2621    return res;
2622  }
2623
2624  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2625    parseDomainResourceProperties(json, res);
2626    if (json.has("identifier"))
2627      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2628    if (json.has("actuality"))
2629      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(),
2630          AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2631    if (json.has("_actuality"))
2632      parseElementProperties(getJObject(json, "_actuality"), res.getActualityElement());
2633    if (json.has("category")) {
2634      JsonArray array = json.getAsJsonArray("category");
2635      for (int i = 0; i < array.size(); i++) {
2636        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2637      }
2638    }
2639    ;
2640    if (json.has("event"))
2641      res.setEvent(parseCodeableConcept(getJObject(json, "event")));
2642    if (json.has("subject"))
2643      res.setSubject(parseReference(getJObject(json, "subject")));
2644    if (json.has("encounter"))
2645      res.setEncounter(parseReference(getJObject(json, "encounter")));
2646    if (json.has("date"))
2647      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2648    if (json.has("_date"))
2649      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2650    if (json.has("detected"))
2651      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2652    if (json.has("_detected"))
2653      parseElementProperties(getJObject(json, "_detected"), res.getDetectedElement());
2654    if (json.has("recordedDate"))
2655      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2656    if (json.has("_recordedDate"))
2657      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2658    if (json.has("resultingCondition")) {
2659      JsonArray array = json.getAsJsonArray("resultingCondition");
2660      for (int i = 0; i < array.size(); i++) {
2661        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2662      }
2663    }
2664    ;
2665    if (json.has("location"))
2666      res.setLocation(parseReference(getJObject(json, "location")));
2667    if (json.has("seriousness"))
2668      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
2669    if (json.has("severity"))
2670      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
2671    if (json.has("outcome"))
2672      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
2673    if (json.has("recorder"))
2674      res.setRecorder(parseReference(getJObject(json, "recorder")));
2675    if (json.has("contributor")) {
2676      JsonArray array = json.getAsJsonArray("contributor");
2677      for (int i = 0; i < array.size(); i++) {
2678        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2679      }
2680    }
2681    ;
2682    if (json.has("suspectEntity")) {
2683      JsonArray array = json.getAsJsonArray("suspectEntity");
2684      for (int i = 0; i < array.size(); i++) {
2685        res.getSuspectEntity()
2686            .add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2687      }
2688    }
2689    ;
2690    if (json.has("subjectMedicalHistory")) {
2691      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2692      for (int i = 0; i < array.size(); i++) {
2693        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2694      }
2695    }
2696    ;
2697    if (json.has("referenceDocument")) {
2698      JsonArray array = json.getAsJsonArray("referenceDocument");
2699      for (int i = 0; i < array.size(); i++) {
2700        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2701      }
2702    }
2703    ;
2704    if (json.has("study")) {
2705      JsonArray array = json.getAsJsonArray("study");
2706      for (int i = 0; i < array.size(); i++) {
2707        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2708      }
2709    }
2710    ;
2711  }
2712
2713  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(
2714      JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2715    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2716    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2717    return res;
2718  }
2719
2720  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner,
2721      AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2722    parseBackboneElementProperties(json, res);
2723    if (json.has("instance"))
2724      res.setInstance(parseReference(getJObject(json, "instance")));
2725    if (json.has("causality")) {
2726      JsonArray array = json.getAsJsonArray("causality");
2727      for (int i = 0; i < array.size(); i++) {
2728        res.getCausality()
2729            .add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject(), owner));
2730      }
2731    }
2732    ;
2733  }
2734
2735  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(
2736      JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2737    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2738    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2739    return res;
2740  }
2741
2742  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json,
2743      AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res)
2744      throws IOException, FHIRFormatError {
2745    parseBackboneElementProperties(json, res);
2746    if (json.has("assessment"))
2747      res.setAssessment(parseCodeableConcept(getJObject(json, "assessment")));
2748    if (json.has("productRelatedness"))
2749      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2750    if (json.has("_productRelatedness"))
2751      parseElementProperties(getJObject(json, "_productRelatedness"), res.getProductRelatednessElement());
2752    if (json.has("author"))
2753      res.setAuthor(parseReference(getJObject(json, "author")));
2754    if (json.has("method"))
2755      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
2756  }
2757
2758  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2759    AllergyIntolerance res = new AllergyIntolerance();
2760    parseAllergyIntoleranceProperties(json, res);
2761    return res;
2762  }
2763
2764  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res)
2765      throws IOException, FHIRFormatError {
2766    parseDomainResourceProperties(json, res);
2767    if (json.has("identifier")) {
2768      JsonArray array = json.getAsJsonArray("identifier");
2769      for (int i = 0; i < array.size(); i++) {
2770        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2771      }
2772    }
2773    ;
2774    if (json.has("clinicalStatus"))
2775      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
2776    if (json.has("verificationStatus"))
2777      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
2778    if (json.has("type"))
2779      res.setTypeElement(parseEnumeration(json.get("type").getAsString(),
2780          AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2781    if (json.has("_type"))
2782      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2783    if (json.has("category")) {
2784      JsonArray array = json.getAsJsonArray("category");
2785      for (int i = 0; i < array.size(); i++) {
2786        if (array.get(i).isJsonNull()) {
2787          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>());
2788        } else {
2789          res.getCategory()
2790              .add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL,
2791                  new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2792        }
2793      }
2794    }
2795    ;
2796    if (json.has("_category")) {
2797      JsonArray array = json.getAsJsonArray("_category");
2798      for (int i = 0; i < array.size(); i++) {
2799        if (i == res.getCategory().size())
2800          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL,
2801              new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2802        if (array.get(i) instanceof JsonObject)
2803          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2804      }
2805    }
2806    ;
2807    if (json.has("criticality"))
2808      res.setCriticalityElement(
2809          parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL,
2810              new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2811    if (json.has("_criticality"))
2812      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
2813    if (json.has("code"))
2814      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2815    if (json.has("patient"))
2816      res.setPatient(parseReference(getJObject(json, "patient")));
2817    if (json.has("encounter"))
2818      res.setEncounter(parseReference(getJObject(json, "encounter")));
2819    Type onset = parseType("onset", json);
2820    if (onset != null)
2821      res.setOnset(onset);
2822    if (json.has("recordedDate"))
2823      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2824    if (json.has("_recordedDate"))
2825      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2826    if (json.has("recorder"))
2827      res.setRecorder(parseReference(getJObject(json, "recorder")));
2828    if (json.has("asserter"))
2829      res.setAsserter(parseReference(getJObject(json, "asserter")));
2830    if (json.has("lastOccurrence"))
2831      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2832    if (json.has("_lastOccurrence"))
2833      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
2834    if (json.has("note")) {
2835      JsonArray array = json.getAsJsonArray("note");
2836      for (int i = 0; i < array.size(); i++) {
2837        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2838      }
2839    }
2840    ;
2841    if (json.has("reaction")) {
2842      JsonArray array = json.getAsJsonArray("reaction");
2843      for (int i = 0; i < array.size(); i++) {
2844        res.getReaction()
2845            .add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2846      }
2847    }
2848    ;
2849  }
2850
2851  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(
2852      JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2853    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2854    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2855    return res;
2856  }
2857
2858  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json,
2859      AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res)
2860      throws IOException, FHIRFormatError {
2861    parseBackboneElementProperties(json, res);
2862    if (json.has("substance"))
2863      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
2864    if (json.has("manifestation")) {
2865      JsonArray array = json.getAsJsonArray("manifestation");
2866      for (int i = 0; i < array.size(); i++) {
2867        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2868      }
2869    }
2870    ;
2871    if (json.has("description"))
2872      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2873    if (json.has("_description"))
2874      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2875    if (json.has("onset"))
2876      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2877    if (json.has("_onset"))
2878      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
2879    if (json.has("severity"))
2880      res.setSeverityElement(
2881          parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL,
2882              new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2883    if (json.has("_severity"))
2884      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2885    if (json.has("exposureRoute"))
2886      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
2887    if (json.has("note")) {
2888      JsonArray array = json.getAsJsonArray("note");
2889      for (int i = 0; i < array.size(); i++) {
2890        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2891      }
2892    }
2893    ;
2894  }
2895
2896  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2897    Appointment res = new Appointment();
2898    parseAppointmentProperties(json, res);
2899    return res;
2900  }
2901
2902  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2903    parseDomainResourceProperties(json, res);
2904    if (json.has("identifier")) {
2905      JsonArray array = json.getAsJsonArray("identifier");
2906      for (int i = 0; i < array.size(); i++) {
2907        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2908      }
2909    }
2910    ;
2911    if (json.has("status"))
2912      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL,
2913          new Appointment.AppointmentStatusEnumFactory()));
2914    if (json.has("_status"))
2915      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2916    if (json.has("cancelationReason"))
2917      res.setCancelationReason(parseCodeableConcept(getJObject(json, "cancelationReason")));
2918    if (json.has("serviceCategory")) {
2919      JsonArray array = json.getAsJsonArray("serviceCategory");
2920      for (int i = 0; i < array.size(); i++) {
2921        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2922      }
2923    }
2924    ;
2925    if (json.has("serviceType")) {
2926      JsonArray array = json.getAsJsonArray("serviceType");
2927      for (int i = 0; i < array.size(); i++) {
2928        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2929      }
2930    }
2931    ;
2932    if (json.has("specialty")) {
2933      JsonArray array = json.getAsJsonArray("specialty");
2934      for (int i = 0; i < array.size(); i++) {
2935        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2936      }
2937    }
2938    ;
2939    if (json.has("appointmentType"))
2940      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
2941    if (json.has("reasonCode")) {
2942      JsonArray array = json.getAsJsonArray("reasonCode");
2943      for (int i = 0; i < array.size(); i++) {
2944        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2945      }
2946    }
2947    ;
2948    if (json.has("reasonReference")) {
2949      JsonArray array = json.getAsJsonArray("reasonReference");
2950      for (int i = 0; i < array.size(); i++) {
2951        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2952      }
2953    }
2954    ;
2955    if (json.has("priority"))
2956      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2957    if (json.has("_priority"))
2958      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2959    if (json.has("description"))
2960      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2961    if (json.has("_description"))
2962      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2963    if (json.has("supportingInformation")) {
2964      JsonArray array = json.getAsJsonArray("supportingInformation");
2965      for (int i = 0; i < array.size(); i++) {
2966        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2967      }
2968    }
2969    ;
2970    if (json.has("start"))
2971      res.setStartElement(parseInstant(json.get("start").getAsString()));
2972    if (json.has("_start"))
2973      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2974    if (json.has("end"))
2975      res.setEndElement(parseInstant(json.get("end").getAsString()));
2976    if (json.has("_end"))
2977      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2978    if (json.has("minutesDuration"))
2979      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2980    if (json.has("_minutesDuration"))
2981      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
2982    if (json.has("slot")) {
2983      JsonArray array = json.getAsJsonArray("slot");
2984      for (int i = 0; i < array.size(); i++) {
2985        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2986      }
2987    }
2988    ;
2989    if (json.has("created"))
2990      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2991    if (json.has("_created"))
2992      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2993    if (json.has("comment"))
2994      res.setCommentElement(parseString(json.get("comment").getAsString()));
2995    if (json.has("_comment"))
2996      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2997    if (json.has("patientInstruction"))
2998      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2999    if (json.has("_patientInstruction"))
3000      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
3001    if (json.has("basedOn")) {
3002      JsonArray array = json.getAsJsonArray("basedOn");
3003      for (int i = 0; i < array.size(); i++) {
3004        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3005      }
3006    }
3007    ;
3008    if (json.has("participant")) {
3009      JsonArray array = json.getAsJsonArray("participant");
3010      for (int i = 0; i < array.size(); i++) {
3011        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
3012      }
3013    }
3014    ;
3015    if (json.has("requestedPeriod")) {
3016      JsonArray array = json.getAsJsonArray("requestedPeriod");
3017      for (int i = 0; i < array.size(); i++) {
3018        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
3019      }
3020    }
3021    ;
3022  }
3023
3024  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json,
3025      Appointment owner) throws IOException, FHIRFormatError {
3026    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
3027    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
3028    return res;
3029  }
3030
3031  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner,
3032      Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
3033    parseBackboneElementProperties(json, res);
3034    if (json.has("type")) {
3035      JsonArray array = json.getAsJsonArray("type");
3036      for (int i = 0; i < array.size(); i++) {
3037        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3038      }
3039    }
3040    ;
3041    if (json.has("actor"))
3042      res.setActor(parseReference(getJObject(json, "actor")));
3043    if (json.has("required"))
3044      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL,
3045          new Appointment.ParticipantRequiredEnumFactory()));
3046    if (json.has("_required"))
3047      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
3048    if (json.has("status"))
3049      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL,
3050          new Appointment.ParticipationStatusEnumFactory()));
3051    if (json.has("_status"))
3052      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3053    if (json.has("period"))
3054      res.setPeriod(parsePeriod(getJObject(json, "period")));
3055  }
3056
3057  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
3058    AppointmentResponse res = new AppointmentResponse();
3059    parseAppointmentResponseProperties(json, res);
3060    return res;
3061  }
3062
3063  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res)
3064      throws IOException, FHIRFormatError {
3065    parseDomainResourceProperties(json, res);
3066    if (json.has("identifier")) {
3067      JsonArray array = json.getAsJsonArray("identifier");
3068      for (int i = 0; i < array.size(); i++) {
3069        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3070      }
3071    }
3072    ;
3073    if (json.has("appointment"))
3074      res.setAppointment(parseReference(getJObject(json, "appointment")));
3075    if (json.has("start"))
3076      res.setStartElement(parseInstant(json.get("start").getAsString()));
3077    if (json.has("_start"))
3078      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
3079    if (json.has("end"))
3080      res.setEndElement(parseInstant(json.get("end").getAsString()));
3081    if (json.has("_end"))
3082      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
3083    if (json.has("participantType")) {
3084      JsonArray array = json.getAsJsonArray("participantType");
3085      for (int i = 0; i < array.size(); i++) {
3086        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3087      }
3088    }
3089    ;
3090    if (json.has("actor"))
3091      res.setActor(parseReference(getJObject(json, "actor")));
3092    if (json.has("participantStatus"))
3093      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(),
3094          AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
3095    if (json.has("_participantStatus"))
3096      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
3097    if (json.has("comment"))
3098      res.setCommentElement(parseString(json.get("comment").getAsString()));
3099    if (json.has("_comment"))
3100      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
3101  }
3102
3103  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
3104    AuditEvent res = new AuditEvent();
3105    parseAuditEventProperties(json, res);
3106    return res;
3107  }
3108
3109  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
3110    parseDomainResourceProperties(json, res);
3111    if (json.has("type"))
3112      res.setType(parseCoding(getJObject(json, "type")));
3113    if (json.has("subtype")) {
3114      JsonArray array = json.getAsJsonArray("subtype");
3115      for (int i = 0; i < array.size(); i++) {
3116        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
3117      }
3118    }
3119    ;
3120    if (json.has("action"))
3121      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL,
3122          new AuditEvent.AuditEventActionEnumFactory()));
3123    if (json.has("_action"))
3124      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
3125    if (json.has("period"))
3126      res.setPeriod(parsePeriod(getJObject(json, "period")));
3127    if (json.has("recorded"))
3128      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
3129    if (json.has("_recorded"))
3130      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
3131    if (json.has("outcome"))
3132      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL,
3133          new AuditEvent.AuditEventOutcomeEnumFactory()));
3134    if (json.has("_outcome"))
3135      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
3136    if (json.has("outcomeDesc"))
3137      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
3138    if (json.has("_outcomeDesc"))
3139      parseElementProperties(getJObject(json, "_outcomeDesc"), res.getOutcomeDescElement());
3140    if (json.has("purposeOfEvent")) {
3141      JsonArray array = json.getAsJsonArray("purposeOfEvent");
3142      for (int i = 0; i < array.size(); i++) {
3143        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3144      }
3145    }
3146    ;
3147    if (json.has("agent")) {
3148      JsonArray array = json.getAsJsonArray("agent");
3149      for (int i = 0; i < array.size(); i++) {
3150        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
3151      }
3152    }
3153    ;
3154    if (json.has("source"))
3155      res.setSource(parseAuditEventAuditEventSourceComponent(getJObject(json, "source"), res));
3156    if (json.has("entity")) {
3157      JsonArray array = json.getAsJsonArray("entity");
3158      for (int i = 0; i < array.size(); i++) {
3159        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
3160      }
3161    }
3162    ;
3163  }
3164
3165  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json,
3166      AuditEvent owner) throws IOException, FHIRFormatError {
3167    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
3168    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
3169    return res;
3170  }
3171
3172  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner,
3173      AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
3174    parseBackboneElementProperties(json, res);
3175    if (json.has("type"))
3176      res.setType(parseCodeableConcept(getJObject(json, "type")));
3177    if (json.has("role")) {
3178      JsonArray array = json.getAsJsonArray("role");
3179      for (int i = 0; i < array.size(); i++) {
3180        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3181      }
3182    }
3183    ;
3184    if (json.has("who"))
3185      res.setWho(parseReference(getJObject(json, "who")));
3186    if (json.has("altId"))
3187      res.setAltIdElement(parseString(json.get("altId").getAsString()));
3188    if (json.has("_altId"))
3189      parseElementProperties(getJObject(json, "_altId"), res.getAltIdElement());
3190    if (json.has("name"))
3191      res.setNameElement(parseString(json.get("name").getAsString()));
3192    if (json.has("_name"))
3193      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3194    if (json.has("requestor"))
3195      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
3196    if (json.has("_requestor"))
3197      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
3198    if (json.has("location"))
3199      res.setLocation(parseReference(getJObject(json, "location")));
3200    if (json.has("policy")) {
3201      JsonArray array = json.getAsJsonArray("policy");
3202      for (int i = 0; i < array.size(); i++) {
3203        if (array.get(i).isJsonNull()) {
3204          res.getPolicy().add(new UriType());
3205        } else {
3206          res.getPolicy().add(parseUri(array.get(i).getAsString()));
3207        }
3208      }
3209    }
3210    ;
3211    if (json.has("_policy")) {
3212      JsonArray array = json.getAsJsonArray("_policy");
3213      for (int i = 0; i < array.size(); i++) {
3214        if (i == res.getPolicy().size())
3215          res.getPolicy().add(parseUri(null));
3216        if (array.get(i) instanceof JsonObject)
3217          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
3218      }
3219    }
3220    ;
3221    if (json.has("media"))
3222      res.setMedia(parseCoding(getJObject(json, "media")));
3223    if (json.has("network"))
3224      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(getJObject(json, "network"), owner));
3225    if (json.has("purposeOfUse")) {
3226      JsonArray array = json.getAsJsonArray("purposeOfUse");
3227      for (int i = 0; i < array.size(); i++) {
3228        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3229      }
3230    }
3231    ;
3232  }
3233
3234  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json,
3235      AuditEvent owner) throws IOException, FHIRFormatError {
3236    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
3237    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
3238    return res;
3239  }
3240
3241  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner,
3242      AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
3243    parseBackboneElementProperties(json, res);
3244    if (json.has("address"))
3245      res.setAddressElement(parseString(json.get("address").getAsString()));
3246    if (json.has("_address"))
3247      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
3248    if (json.has("type"))
3249      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL,
3250          new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
3251    if (json.has("_type"))
3252      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3253  }
3254
3255  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json,
3256      AuditEvent owner) throws IOException, FHIRFormatError {
3257    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
3258    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
3259    return res;
3260  }
3261
3262  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner,
3263      AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
3264    parseBackboneElementProperties(json, res);
3265    if (json.has("site"))
3266      res.setSiteElement(parseString(json.get("site").getAsString()));
3267    if (json.has("_site"))
3268      parseElementProperties(getJObject(json, "_site"), res.getSiteElement());
3269    if (json.has("observer"))
3270      res.setObserver(parseReference(getJObject(json, "observer")));
3271    if (json.has("type")) {
3272      JsonArray array = json.getAsJsonArray("type");
3273      for (int i = 0; i < array.size(); i++) {
3274        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
3275      }
3276    }
3277    ;
3278  }
3279
3280  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json,
3281      AuditEvent owner) throws IOException, FHIRFormatError {
3282    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3283    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
3284    return res;
3285  }
3286
3287  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner,
3288      AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
3289    parseBackboneElementProperties(json, res);
3290    if (json.has("what"))
3291      res.setWhat(parseReference(getJObject(json, "what")));
3292    if (json.has("type"))
3293      res.setType(parseCoding(getJObject(json, "type")));
3294    if (json.has("role"))
3295      res.setRole(parseCoding(getJObject(json, "role")));
3296    if (json.has("lifecycle"))
3297      res.setLifecycle(parseCoding(getJObject(json, "lifecycle")));
3298    if (json.has("securityLabel")) {
3299      JsonArray array = json.getAsJsonArray("securityLabel");
3300      for (int i = 0; i < array.size(); i++) {
3301        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
3302      }
3303    }
3304    ;
3305    if (json.has("name"))
3306      res.setNameElement(parseString(json.get("name").getAsString()));
3307    if (json.has("_name"))
3308      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3309    if (json.has("description"))
3310      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3311    if (json.has("_description"))
3312      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3313    if (json.has("query"))
3314      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
3315    if (json.has("_query"))
3316      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
3317    if (json.has("detail")) {
3318      JsonArray array = json.getAsJsonArray("detail");
3319      for (int i = 0; i < array.size(); i++) {
3320        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
3321      }
3322    }
3323    ;
3324  }
3325
3326  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json,
3327      AuditEvent owner) throws IOException, FHIRFormatError {
3328    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
3329    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
3330    return res;
3331  }
3332
3333  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner,
3334      AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
3335    parseBackboneElementProperties(json, res);
3336    if (json.has("type"))
3337      res.setTypeElement(parseString(json.get("type").getAsString()));
3338    if (json.has("_type"))
3339      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3340    Type value = parseType("value", json);
3341    if (value != null)
3342      res.setValue(value);
3343  }
3344
3345  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
3346    Basic res = new Basic();
3347    parseBasicProperties(json, res);
3348    return res;
3349  }
3350
3351  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
3352    parseDomainResourceProperties(json, res);
3353    if (json.has("identifier")) {
3354      JsonArray array = json.getAsJsonArray("identifier");
3355      for (int i = 0; i < array.size(); i++) {
3356        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3357      }
3358    }
3359    ;
3360    if (json.has("code"))
3361      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3362    if (json.has("subject"))
3363      res.setSubject(parseReference(getJObject(json, "subject")));
3364    if (json.has("created"))
3365      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3366    if (json.has("_created"))
3367      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
3368    if (json.has("author"))
3369      res.setAuthor(parseReference(getJObject(json, "author")));
3370  }
3371
3372  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3373    Binary res = new Binary();
3374    parseBinaryProperties(json, res);
3375    return res;
3376  }
3377
3378  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3379    parseResourceProperties(json, res);
3380    if (json.has("contentType"))
3381      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3382    if (json.has("_contentType"))
3383      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
3384    if (json.has("securityContext"))
3385      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
3386    if (json.has("data"))
3387      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3388    if (json.has("_data"))
3389      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
3390  }
3391
3392  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json)
3393      throws IOException, FHIRFormatError {
3394    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3395    parseBiologicallyDerivedProductProperties(json, res);
3396    return res;
3397  }
3398
3399  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res)
3400      throws IOException, FHIRFormatError {
3401    parseDomainResourceProperties(json, res);
3402    if (json.has("identifier")) {
3403      JsonArray array = json.getAsJsonArray("identifier");
3404      for (int i = 0; i < array.size(); i++) {
3405        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3406      }
3407    }
3408    ;
3409    if (json.has("productCategory"))
3410      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(),
3411          BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL,
3412          new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3413    if (json.has("_productCategory"))
3414      parseElementProperties(getJObject(json, "_productCategory"), res.getProductCategoryElement());
3415    if (json.has("productCode"))
3416      res.setProductCode(parseCodeableConcept(getJObject(json, "productCode")));
3417    if (json.has("status"))
3418      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
3419          BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL,
3420          new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3421    if (json.has("_status"))
3422      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3423    if (json.has("request")) {
3424      JsonArray array = json.getAsJsonArray("request");
3425      for (int i = 0; i < array.size(); i++) {
3426        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3427      }
3428    }
3429    ;
3430    if (json.has("quantity"))
3431      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3432    if (json.has("_quantity"))
3433      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
3434    if (json.has("parent")) {
3435      JsonArray array = json.getAsJsonArray("parent");
3436      for (int i = 0; i < array.size(); i++) {
3437        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3438      }
3439    }
3440    ;
3441    if (json.has("collection"))
3442      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(
3443          getJObject(json, "collection"), res));
3444    if (json.has("processing")) {
3445      JsonArray array = json.getAsJsonArray("processing");
3446      for (int i = 0; i < array.size(); i++) {
3447        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(
3448            array.get(i).getAsJsonObject(), res));
3449      }
3450    }
3451    ;
3452    if (json.has("manipulation"))
3453      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(
3454          getJObject(json, "manipulation"), res));
3455    if (json.has("storage")) {
3456      JsonArray array = json.getAsJsonArray("storage");
3457      for (int i = 0; i < array.size(); i++) {
3458        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(
3459            array.get(i).getAsJsonObject(), res));
3460      }
3461    }
3462    ;
3463  }
3464
3465  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(
3466      JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3467    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3468    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3469    return res;
3470  }
3471
3472  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json,
3473      BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res)
3474      throws IOException, FHIRFormatError {
3475    parseBackboneElementProperties(json, res);
3476    if (json.has("collector"))
3477      res.setCollector(parseReference(getJObject(json, "collector")));
3478    if (json.has("source"))
3479      res.setSource(parseReference(getJObject(json, "source")));
3480    Type collected = parseType("collected", json);
3481    if (collected != null)
3482      res.setCollected(collected);
3483  }
3484
3485  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(
3486      JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3487    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3488    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3489    return res;
3490  }
3491
3492  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json,
3493      BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res)
3494      throws IOException, FHIRFormatError {
3495    parseBackboneElementProperties(json, res);
3496    if (json.has("description"))
3497      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3498    if (json.has("_description"))
3499      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3500    if (json.has("procedure"))
3501      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
3502    if (json.has("additive"))
3503      res.setAdditive(parseReference(getJObject(json, "additive")));
3504    Type time = parseType("time", json);
3505    if (time != null)
3506      res.setTime(time);
3507  }
3508
3509  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(
3510      JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3511    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3512    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3513    return res;
3514  }
3515
3516  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(
3517      JsonObject json, BiologicallyDerivedProduct owner,
3518      BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res)
3519      throws IOException, FHIRFormatError {
3520    parseBackboneElementProperties(json, res);
3521    if (json.has("description"))
3522      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3523    if (json.has("_description"))
3524      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3525    Type time = parseType("time", json);
3526    if (time != null)
3527      res.setTime(time);
3528  }
3529
3530  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(
3531      JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3532    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3533    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3534    return res;
3535  }
3536
3537  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json,
3538      BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res)
3539      throws IOException, FHIRFormatError {
3540    parseBackboneElementProperties(json, res);
3541    if (json.has("description"))
3542      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3543    if (json.has("_description"))
3544      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3545    if (json.has("temperature"))
3546      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3547    if (json.has("_temperature"))
3548      parseElementProperties(getJObject(json, "_temperature"), res.getTemperatureElement());
3549    if (json.has("scale"))
3550      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(),
3551          BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL,
3552          new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3553    if (json.has("_scale"))
3554      parseElementProperties(getJObject(json, "_scale"), res.getScaleElement());
3555    if (json.has("duration"))
3556      res.setDuration(parsePeriod(getJObject(json, "duration")));
3557  }
3558
3559  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3560    BodyStructure res = new BodyStructure();
3561    parseBodyStructureProperties(json, res);
3562    return res;
3563  }
3564
3565  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3566    parseDomainResourceProperties(json, res);
3567    if (json.has("identifier")) {
3568      JsonArray array = json.getAsJsonArray("identifier");
3569      for (int i = 0; i < array.size(); i++) {
3570        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3571      }
3572    }
3573    ;
3574    if (json.has("active"))
3575      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3576    if (json.has("_active"))
3577      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
3578    if (json.has("morphology"))
3579      res.setMorphology(parseCodeableConcept(getJObject(json, "morphology")));
3580    if (json.has("location"))
3581      res.setLocation(parseCodeableConcept(getJObject(json, "location")));
3582    if (json.has("locationQualifier")) {
3583      JsonArray array = json.getAsJsonArray("locationQualifier");
3584      for (int i = 0; i < array.size(); i++) {
3585        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3586      }
3587    }
3588    ;
3589    if (json.has("description"))
3590      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3591    if (json.has("_description"))
3592      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3593    if (json.has("image")) {
3594      JsonArray array = json.getAsJsonArray("image");
3595      for (int i = 0; i < array.size(); i++) {
3596        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3597      }
3598    }
3599    ;
3600    if (json.has("patient"))
3601      res.setPatient(parseReference(getJObject(json, "patient")));
3602  }
3603
3604  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3605    Bundle res = new Bundle();
3606    parseBundleProperties(json, res);
3607    return res;
3608  }
3609
3610  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3611    parseResourceProperties(json, res);
3612    if (json.has("identifier"))
3613      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
3614    if (json.has("type"))
3615      res.setTypeElement(
3616          parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3617    if (json.has("_type"))
3618      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3619    if (json.has("timestamp"))
3620      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3621    if (json.has("_timestamp"))
3622      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
3623    if (json.has("total"))
3624      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3625    if (json.has("_total"))
3626      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
3627    if (json.has("link")) {
3628      JsonArray array = json.getAsJsonArray("link");
3629      for (int i = 0; i < array.size(); i++) {
3630        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3631      }
3632    }
3633    ;
3634    if (json.has("entry")) {
3635      JsonArray array = json.getAsJsonArray("entry");
3636      for (int i = 0; i < array.size(); i++) {
3637        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3638      }
3639    }
3640    ;
3641    if (json.has("signature"))
3642      res.setSignature(parseSignature(getJObject(json, "signature")));
3643  }
3644
3645  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner)
3646      throws IOException, FHIRFormatError {
3647    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3648    parseBundleBundleLinkComponentProperties(json, owner, res);
3649    return res;
3650  }
3651
3652  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res)
3653      throws IOException, FHIRFormatError {
3654    parseBackboneElementProperties(json, res);
3655    if (json.has("relation"))
3656      res.setRelationElement(parseString(json.get("relation").getAsString()));
3657    if (json.has("_relation"))
3658      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
3659    if (json.has("url"))
3660      res.setUrlElement(parseUri(json.get("url").getAsString()));
3661    if (json.has("_url"))
3662      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3663  }
3664
3665  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner)
3666      throws IOException, FHIRFormatError {
3667    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3668    parseBundleBundleEntryComponentProperties(json, owner, res);
3669    return res;
3670  }
3671
3672  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner,
3673      Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3674    parseBackboneElementProperties(json, res);
3675    if (json.has("link")) {
3676      JsonArray array = json.getAsJsonArray("link");
3677      for (int i = 0; i < array.size(); i++) {
3678        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3679      }
3680    }
3681    ;
3682    if (json.has("fullUrl"))
3683      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3684    if (json.has("_fullUrl"))
3685      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
3686    if (json.has("resource"))
3687      res.setResource(parseResource(getJObject(json, "resource")));
3688    if (json.has("search"))
3689      res.setSearch(parseBundleBundleEntrySearchComponent(getJObject(json, "search"), owner));
3690    if (json.has("request"))
3691      res.setRequest(parseBundleBundleEntryRequestComponent(getJObject(json, "request"), owner));
3692    if (json.has("response"))
3693      res.setResponse(parseBundleBundleEntryResponseComponent(getJObject(json, "response"), owner));
3694  }
3695
3696  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner)
3697      throws IOException, FHIRFormatError {
3698    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3699    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3700    return res;
3701  }
3702
3703  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner,
3704      Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3705    parseBackboneElementProperties(json, res);
3706    if (json.has("mode"))
3707      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL,
3708          new Bundle.SearchEntryModeEnumFactory()));
3709    if (json.has("_mode"))
3710      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3711    if (json.has("score"))
3712      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3713    if (json.has("_score"))
3714      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
3715  }
3716
3717  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner)
3718      throws IOException, FHIRFormatError {
3719    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3720    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3721    return res;
3722  }
3723
3724  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner,
3725      Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3726    parseBackboneElementProperties(json, res);
3727    if (json.has("method"))
3728      res.setMethodElement(
3729          parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3730    if (json.has("_method"))
3731      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
3732    if (json.has("url"))
3733      res.setUrlElement(parseUri(json.get("url").getAsString()));
3734    if (json.has("_url"))
3735      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3736    if (json.has("ifNoneMatch"))
3737      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3738    if (json.has("_ifNoneMatch"))
3739      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
3740    if (json.has("ifModifiedSince"))
3741      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3742    if (json.has("_ifModifiedSince"))
3743      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
3744    if (json.has("ifMatch"))
3745      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3746    if (json.has("_ifMatch"))
3747      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
3748    if (json.has("ifNoneExist"))
3749      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3750    if (json.has("_ifNoneExist"))
3751      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
3752  }
3753
3754  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner)
3755      throws IOException, FHIRFormatError {
3756    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3757    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3758    return res;
3759  }
3760
3761  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner,
3762      Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3763    parseBackboneElementProperties(json, res);
3764    if (json.has("status"))
3765      res.setStatusElement(parseString(json.get("status").getAsString()));
3766    if (json.has("_status"))
3767      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3768    if (json.has("location"))
3769      res.setLocationElement(parseUri(json.get("location").getAsString()));
3770    if (json.has("_location"))
3771      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
3772    if (json.has("etag"))
3773      res.setEtagElement(parseString(json.get("etag").getAsString()));
3774    if (json.has("_etag"))
3775      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
3776    if (json.has("lastModified"))
3777      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3778    if (json.has("_lastModified"))
3779      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
3780    if (json.has("outcome"))
3781      res.setOutcome(parseResource(getJObject(json, "outcome")));
3782  }
3783
3784  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3785    CapabilityStatement res = new CapabilityStatement();
3786    parseCapabilityStatementProperties(json, res);
3787    return res;
3788  }
3789
3790  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res)
3791      throws IOException, FHIRFormatError {
3792    parseDomainResourceProperties(json, res);
3793    if (json.has("url"))
3794      res.setUrlElement(parseUri(json.get("url").getAsString()));
3795    if (json.has("_url"))
3796      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3797    if (json.has("version"))
3798      res.setVersionElement(parseString(json.get("version").getAsString()));
3799    if (json.has("_version"))
3800      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3801    if (json.has("name"))
3802      res.setNameElement(parseString(json.get("name").getAsString()));
3803    if (json.has("_name"))
3804      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3805    if (json.has("title"))
3806      res.setTitleElement(parseString(json.get("title").getAsString()));
3807    if (json.has("_title"))
3808      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3809    if (json.has("status"))
3810      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
3811          new Enumerations.PublicationStatusEnumFactory()));
3812    if (json.has("_status"))
3813      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3814    if (json.has("experimental"))
3815      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3816    if (json.has("_experimental"))
3817      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
3818    if (json.has("date"))
3819      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3820    if (json.has("_date"))
3821      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3822    if (json.has("publisher"))
3823      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3824    if (json.has("_publisher"))
3825      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
3826    if (json.has("contact")) {
3827      JsonArray array = json.getAsJsonArray("contact");
3828      for (int i = 0; i < array.size(); i++) {
3829        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3830      }
3831    }
3832    ;
3833    if (json.has("description"))
3834      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3835    if (json.has("_description"))
3836      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3837    if (json.has("useContext")) {
3838      JsonArray array = json.getAsJsonArray("useContext");
3839      for (int i = 0; i < array.size(); i++) {
3840        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3841      }
3842    }
3843    ;
3844    if (json.has("jurisdiction")) {
3845      JsonArray array = json.getAsJsonArray("jurisdiction");
3846      for (int i = 0; i < array.size(); i++) {
3847        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3848      }
3849    }
3850    ;
3851    if (json.has("purpose"))
3852      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3853    if (json.has("_purpose"))
3854      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
3855    if (json.has("copyright"))
3856      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3857    if (json.has("_copyright"))
3858      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3859    if (json.has("kind"))
3860      res.setKindElement(
3861          parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL,
3862              new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3863    if (json.has("_kind"))
3864      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
3865    if (json.has("instantiates")) {
3866      JsonArray array = json.getAsJsonArray("instantiates");
3867      for (int i = 0; i < array.size(); i++) {
3868        if (array.get(i).isJsonNull()) {
3869          res.getInstantiates().add(new CanonicalType());
3870        } else {
3871          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3872        }
3873      }
3874    }
3875    ;
3876    if (json.has("_instantiates")) {
3877      JsonArray array = json.getAsJsonArray("_instantiates");
3878      for (int i = 0; i < array.size(); i++) {
3879        if (i == res.getInstantiates().size())
3880          res.getInstantiates().add(parseCanonical(null));
3881        if (array.get(i) instanceof JsonObject)
3882          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3883      }
3884    }
3885    ;
3886    if (json.has("imports")) {
3887      JsonArray array = json.getAsJsonArray("imports");
3888      for (int i = 0; i < array.size(); i++) {
3889        if (array.get(i).isJsonNull()) {
3890          res.getImports().add(new CanonicalType());
3891        } else {
3892          res.getImports().add(parseCanonical(array.get(i).getAsString()));
3893        }
3894      }
3895    }
3896    ;
3897    if (json.has("_imports")) {
3898      JsonArray array = json.getAsJsonArray("_imports");
3899      for (int i = 0; i < array.size(); i++) {
3900        if (i == res.getImports().size())
3901          res.getImports().add(parseCanonical(null));
3902        if (array.get(i) instanceof JsonObject)
3903          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3904      }
3905    }
3906    ;
3907    if (json.has("software"))
3908      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(getJObject(json, "software"), res));
3909    if (json.has("implementation"))
3910      res.setImplementation(
3911          parseCapabilityStatementCapabilityStatementImplementationComponent(getJObject(json, "implementation"), res));
3912    if (json.has("fhirVersion"))
3913      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL,
3914          new Enumerations.FHIRVersionEnumFactory()));
3915    if (json.has("_fhirVersion"))
3916      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
3917    if (json.has("format")) {
3918      JsonArray array = json.getAsJsonArray("format");
3919      for (int i = 0; i < array.size(); i++) {
3920        if (array.get(i).isJsonNull()) {
3921          res.getFormat().add(new CodeType());
3922        } else {
3923          res.getFormat().add(parseCode(array.get(i).getAsString()));
3924        }
3925      }
3926    }
3927    ;
3928    if (json.has("_format")) {
3929      JsonArray array = json.getAsJsonArray("_format");
3930      for (int i = 0; i < array.size(); i++) {
3931        if (i == res.getFormat().size())
3932          res.getFormat().add(parseCode(null));
3933        if (array.get(i) instanceof JsonObject)
3934          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3935      }
3936    }
3937    ;
3938    if (json.has("patchFormat")) {
3939      JsonArray array = json.getAsJsonArray("patchFormat");
3940      for (int i = 0; i < array.size(); i++) {
3941        if (array.get(i).isJsonNull()) {
3942          res.getPatchFormat().add(new CodeType());
3943        } else {
3944          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3945        }
3946      }
3947    }
3948    ;
3949    if (json.has("_patchFormat")) {
3950      JsonArray array = json.getAsJsonArray("_patchFormat");
3951      for (int i = 0; i < array.size(); i++) {
3952        if (i == res.getPatchFormat().size())
3953          res.getPatchFormat().add(parseCode(null));
3954        if (array.get(i) instanceof JsonObject)
3955          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3956      }
3957    }
3958    ;
3959    if (json.has("implementationGuide")) {
3960      JsonArray array = json.getAsJsonArray("implementationGuide");
3961      for (int i = 0; i < array.size(); i++) {
3962        if (array.get(i).isJsonNull()) {
3963          res.getImplementationGuide().add(new CanonicalType());
3964        } else {
3965          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3966        }
3967      }
3968    }
3969    ;
3970    if (json.has("_implementationGuide")) {
3971      JsonArray array = json.getAsJsonArray("_implementationGuide");
3972      for (int i = 0; i < array.size(); i++) {
3973        if (i == res.getImplementationGuide().size())
3974          res.getImplementationGuide().add(parseCanonical(null));
3975        if (array.get(i) instanceof JsonObject)
3976          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3977      }
3978    }
3979    ;
3980    if (json.has("rest")) {
3981      JsonArray array = json.getAsJsonArray("rest");
3982      for (int i = 0; i < array.size(); i++) {
3983        res.getRest()
3984            .add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3985      }
3986    }
3987    ;
3988    if (json.has("messaging")) {
3989      JsonArray array = json.getAsJsonArray("messaging");
3990      for (int i = 0; i < array.size(); i++) {
3991        res.getMessaging()
3992            .add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3993      }
3994    }
3995    ;
3996    if (json.has("document")) {
3997      JsonArray array = json.getAsJsonArray("document");
3998      for (int i = 0; i < array.size(); i++) {
3999        res.getDocument()
4000            .add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
4001      }
4002    }
4003    ;
4004  }
4005
4006  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(
4007      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4008    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
4009    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
4010    return res;
4011  }
4012
4013  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json,
4014      CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res)
4015      throws IOException, FHIRFormatError {
4016    parseBackboneElementProperties(json, res);
4017    if (json.has("name"))
4018      res.setNameElement(parseString(json.get("name").getAsString()));
4019    if (json.has("_name"))
4020      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4021    if (json.has("version"))
4022      res.setVersionElement(parseString(json.get("version").getAsString()));
4023    if (json.has("_version"))
4024      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4025    if (json.has("releaseDate"))
4026      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4027    if (json.has("_releaseDate"))
4028      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
4029  }
4030
4031  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(
4032      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4033    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
4034    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
4035    return res;
4036  }
4037
4038  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json,
4039      CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res)
4040      throws IOException, FHIRFormatError {
4041    parseBackboneElementProperties(json, res);
4042    if (json.has("description"))
4043      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4044    if (json.has("_description"))
4045      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4046    if (json.has("url"))
4047      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4048    if (json.has("_url"))
4049      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4050    if (json.has("custodian"))
4051      res.setCustodian(parseReference(getJObject(json, "custodian")));
4052  }
4053
4054  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(
4055      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4056    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
4057    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
4058    return res;
4059  }
4060
4061  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json,
4062      CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res)
4063      throws IOException, FHIRFormatError {
4064    parseBackboneElementProperties(json, res);
4065    if (json.has("mode"))
4066      res.setModeElement(parseEnumeration(json.get("mode").getAsString(),
4067          CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
4068    if (json.has("_mode"))
4069      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4070    if (json.has("documentation"))
4071      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4072    if (json.has("_documentation"))
4073      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4074    if (json.has("security"))
4075      res.setSecurity(
4076          parseCapabilityStatementCapabilityStatementRestSecurityComponent(getJObject(json, "security"), owner));
4077    if (json.has("resource")) {
4078      JsonArray array = json.getAsJsonArray("resource");
4079      for (int i = 0; i < array.size(); i++) {
4080        res.getResource().add(
4081            parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
4082      }
4083    }
4084    ;
4085    if (json.has("interaction")) {
4086      JsonArray array = json.getAsJsonArray("interaction");
4087      for (int i = 0; i < array.size(); i++) {
4088        res.getInteraction()
4089            .add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
4090      }
4091    }
4092    ;
4093    if (json.has("searchParam")) {
4094      JsonArray array = json.getAsJsonArray("searchParam");
4095      for (int i = 0; i < array.size(); i++) {
4096        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(
4097            array.get(i).getAsJsonObject(), owner));
4098      }
4099    }
4100    ;
4101    if (json.has("operation")) {
4102      JsonArray array = json.getAsJsonArray("operation");
4103      for (int i = 0; i < array.size(); i++) {
4104        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(
4105            array.get(i).getAsJsonObject(), owner));
4106      }
4107    }
4108    ;
4109    if (json.has("compartment")) {
4110      JsonArray array = json.getAsJsonArray("compartment");
4111      for (int i = 0; i < array.size(); i++) {
4112        if (array.get(i).isJsonNull()) {
4113          res.getCompartment().add(new CanonicalType());
4114        } else {
4115          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4116        }
4117      }
4118    }
4119    ;
4120    if (json.has("_compartment")) {
4121      JsonArray array = json.getAsJsonArray("_compartment");
4122      for (int i = 0; i < array.size(); i++) {
4123        if (i == res.getCompartment().size())
4124          res.getCompartment().add(parseCanonical(null));
4125        if (array.get(i) instanceof JsonObject)
4126          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4127      }
4128    }
4129    ;
4130  }
4131
4132  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(
4133      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4134    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
4135    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
4136    return res;
4137  }
4138
4139  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json,
4140      CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res)
4141      throws IOException, FHIRFormatError {
4142    parseBackboneElementProperties(json, res);
4143    if (json.has("cors"))
4144      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
4145    if (json.has("_cors"))
4146      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
4147    if (json.has("service")) {
4148      JsonArray array = json.getAsJsonArray("service");
4149      for (int i = 0; i < array.size(); i++) {
4150        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4151      }
4152    }
4153    ;
4154    if (json.has("description"))
4155      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4156    if (json.has("_description"))
4157      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4158  }
4159
4160  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(
4161      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4162    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
4163    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
4164    return res;
4165  }
4166
4167  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json,
4168      CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res)
4169      throws IOException, FHIRFormatError {
4170    parseBackboneElementProperties(json, res);
4171    if (json.has("type"))
4172      res.setTypeElement(parseCode(json.get("type").getAsString()));
4173    if (json.has("_type"))
4174      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4175    if (json.has("profile"))
4176      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4177    if (json.has("_profile"))
4178      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4179    if (json.has("supportedProfile")) {
4180      JsonArray array = json.getAsJsonArray("supportedProfile");
4181      for (int i = 0; i < array.size(); i++) {
4182        if (array.get(i).isJsonNull()) {
4183          res.getSupportedProfile().add(new CanonicalType());
4184        } else {
4185          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4186        }
4187      }
4188    }
4189    ;
4190    if (json.has("_supportedProfile")) {
4191      JsonArray array = json.getAsJsonArray("_supportedProfile");
4192      for (int i = 0; i < array.size(); i++) {
4193        if (i == res.getSupportedProfile().size())
4194          res.getSupportedProfile().add(parseCanonical(null));
4195        if (array.get(i) instanceof JsonObject)
4196          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4197      }
4198    }
4199    ;
4200    if (json.has("documentation"))
4201      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4202    if (json.has("_documentation"))
4203      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4204    if (json.has("interaction")) {
4205      JsonArray array = json.getAsJsonArray("interaction");
4206      for (int i = 0; i < array.size(); i++) {
4207        res.getInteraction()
4208            .add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
4209      }
4210    }
4211    ;
4212    if (json.has("versioning"))
4213      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(),
4214          CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
4215    if (json.has("_versioning"))
4216      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
4217    if (json.has("readHistory"))
4218      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
4219    if (json.has("_readHistory"))
4220      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
4221    if (json.has("updateCreate"))
4222      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
4223    if (json.has("_updateCreate"))
4224      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
4225    if (json.has("conditionalCreate"))
4226      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
4227    if (json.has("_conditionalCreate"))
4228      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
4229    if (json.has("conditionalRead"))
4230      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(),
4231          CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
4232    if (json.has("_conditionalRead"))
4233      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
4234    if (json.has("conditionalUpdate"))
4235      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
4236    if (json.has("_conditionalUpdate"))
4237      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
4238    if (json.has("conditionalDelete"))
4239      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(),
4240          CapabilityStatement.ConditionalDeleteStatus.NULL,
4241          new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
4242    if (json.has("_conditionalDelete"))
4243      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
4244    if (json.has("referencePolicy")) {
4245      JsonArray array = json.getAsJsonArray("referencePolicy");
4246      for (int i = 0; i < array.size(); i++) {
4247        if (array.get(i).isJsonNull()) {
4248          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>());
4249        } else {
4250          res.getReferencePolicy()
4251              .add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL,
4252                  new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4253        }
4254      }
4255    }
4256    ;
4257    if (json.has("_referencePolicy")) {
4258      JsonArray array = json.getAsJsonArray("_referencePolicy");
4259      for (int i = 0; i < array.size(); i++) {
4260        if (i == res.getReferencePolicy().size())
4261          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL,
4262              new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4263        if (array.get(i) instanceof JsonObject)
4264          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
4265      }
4266    }
4267    ;
4268    if (json.has("searchInclude")) {
4269      JsonArray array = json.getAsJsonArray("searchInclude");
4270      for (int i = 0; i < array.size(); i++) {
4271        if (array.get(i).isJsonNull()) {
4272          res.getSearchInclude().add(new StringType());
4273        } else {
4274          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
4275        }
4276      }
4277    }
4278    ;
4279    if (json.has("_searchInclude")) {
4280      JsonArray array = json.getAsJsonArray("_searchInclude");
4281      for (int i = 0; i < array.size(); i++) {
4282        if (i == res.getSearchInclude().size())
4283          res.getSearchInclude().add(parseString(null));
4284        if (array.get(i) instanceof JsonObject)
4285          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
4286      }
4287    }
4288    ;
4289    if (json.has("searchRevInclude")) {
4290      JsonArray array = json.getAsJsonArray("searchRevInclude");
4291      for (int i = 0; i < array.size(); i++) {
4292        if (array.get(i).isJsonNull()) {
4293          res.getSearchRevInclude().add(new StringType());
4294        } else {
4295          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
4296        }
4297      }
4298    }
4299    ;
4300    if (json.has("_searchRevInclude")) {
4301      JsonArray array = json.getAsJsonArray("_searchRevInclude");
4302      for (int i = 0; i < array.size(); i++) {
4303        if (i == res.getSearchRevInclude().size())
4304          res.getSearchRevInclude().add(parseString(null));
4305        if (array.get(i) instanceof JsonObject)
4306          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
4307      }
4308    }
4309    ;
4310    if (json.has("searchParam")) {
4311      JsonArray array = json.getAsJsonArray("searchParam");
4312      for (int i = 0; i < array.size(); i++) {
4313        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(
4314            array.get(i).getAsJsonObject(), owner));
4315      }
4316    }
4317    ;
4318    if (json.has("operation")) {
4319      JsonArray array = json.getAsJsonArray("operation");
4320      for (int i = 0; i < array.size(); i++) {
4321        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(
4322            array.get(i).getAsJsonObject(), owner));
4323      }
4324    }
4325    ;
4326  }
4327
4328  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(
4329      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4330    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
4331    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
4332    return res;
4333  }
4334
4335  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json,
4336      CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res)
4337      throws IOException, FHIRFormatError {
4338    parseBackboneElementProperties(json, res);
4339    if (json.has("code"))
4340      res.setCodeElement(
4341          parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL,
4342              new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
4343    if (json.has("_code"))
4344      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4345    if (json.has("documentation"))
4346      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4347    if (json.has("_documentation"))
4348      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4349  }
4350
4351  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(
4352      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4353    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
4354    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
4355    return res;
4356  }
4357
4358  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json,
4359      CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res)
4360      throws IOException, FHIRFormatError {
4361    parseBackboneElementProperties(json, res);
4362    if (json.has("name"))
4363      res.setNameElement(parseString(json.get("name").getAsString()));
4364    if (json.has("_name"))
4365      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4366    if (json.has("definition"))
4367      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4368    if (json.has("_definition"))
4369      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4370    if (json.has("type"))
4371      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL,
4372          new Enumerations.SearchParamTypeEnumFactory()));
4373    if (json.has("_type"))
4374      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4375    if (json.has("documentation"))
4376      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4377    if (json.has("_documentation"))
4378      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4379  }
4380
4381  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(
4382      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4383    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
4384    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
4385    return res;
4386  }
4387
4388  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json,
4389      CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res)
4390      throws IOException, FHIRFormatError {
4391    parseBackboneElementProperties(json, res);
4392    if (json.has("name"))
4393      res.setNameElement(parseString(json.get("name").getAsString()));
4394    if (json.has("_name"))
4395      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4396    if (json.has("definition"))
4397      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4398    if (json.has("_definition"))
4399      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4400    if (json.has("documentation"))
4401      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4402    if (json.has("_documentation"))
4403      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4404  }
4405
4406  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(
4407      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4408    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
4409    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
4410    return res;
4411  }
4412
4413  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json,
4414      CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res)
4415      throws IOException, FHIRFormatError {
4416    parseBackboneElementProperties(json, res);
4417    if (json.has("code"))
4418      res.setCodeElement(
4419          parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL,
4420              new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
4421    if (json.has("_code"))
4422      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4423    if (json.has("documentation"))
4424      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4425    if (json.has("_documentation"))
4426      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4427  }
4428
4429  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(
4430      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4431    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
4432    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
4433    return res;
4434  }
4435
4436  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json,
4437      CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res)
4438      throws IOException, FHIRFormatError {
4439    parseBackboneElementProperties(json, res);
4440    if (json.has("endpoint")) {
4441      JsonArray array = json.getAsJsonArray("endpoint");
4442      for (int i = 0; i < array.size(); i++) {
4443        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(
4444            array.get(i).getAsJsonObject(), owner));
4445      }
4446    }
4447    ;
4448    if (json.has("reliableCache"))
4449      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
4450    if (json.has("_reliableCache"))
4451      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
4452    if (json.has("documentation"))
4453      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4454    if (json.has("_documentation"))
4455      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4456    if (json.has("supportedMessage")) {
4457      JsonArray array = json.getAsJsonArray("supportedMessage");
4458      for (int i = 0; i < array.size(); i++) {
4459        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(
4460            array.get(i).getAsJsonObject(), owner));
4461      }
4462    }
4463    ;
4464  }
4465
4466  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(
4467      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4468    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
4469    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
4470    return res;
4471  }
4472
4473  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json,
4474      CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res)
4475      throws IOException, FHIRFormatError {
4476    parseBackboneElementProperties(json, res);
4477    if (json.has("protocol"))
4478      res.setProtocol(parseCoding(getJObject(json, "protocol")));
4479    if (json.has("address"))
4480      res.setAddressElement(parseUrl(json.get("address").getAsString()));
4481    if (json.has("_address"))
4482      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
4483  }
4484
4485  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(
4486      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4487    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
4488    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
4489    return res;
4490  }
4491
4492  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(
4493      JsonObject json, CapabilityStatement owner,
4494      CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res)
4495      throws IOException, FHIRFormatError {
4496    parseBackboneElementProperties(json, res);
4497    if (json.has("mode"))
4498      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL,
4499          new CapabilityStatement.EventCapabilityModeEnumFactory()));
4500    if (json.has("_mode"))
4501      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4502    if (json.has("definition"))
4503      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4504    if (json.has("_definition"))
4505      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4506  }
4507
4508  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(
4509      JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4510    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
4511    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
4512    return res;
4513  }
4514
4515  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json,
4516      CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res)
4517      throws IOException, FHIRFormatError {
4518    parseBackboneElementProperties(json, res);
4519    if (json.has("mode"))
4520      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL,
4521          new CapabilityStatement.DocumentModeEnumFactory()));
4522    if (json.has("_mode"))
4523      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4524    if (json.has("documentation"))
4525      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4526    if (json.has("_documentation"))
4527      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4528    if (json.has("profile"))
4529      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4530    if (json.has("_profile"))
4531      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4532  }
4533
4534  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
4535    CarePlan res = new CarePlan();
4536    parseCarePlanProperties(json, res);
4537    return res;
4538  }
4539
4540  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
4541    parseDomainResourceProperties(json, res);
4542    if (json.has("identifier")) {
4543      JsonArray array = json.getAsJsonArray("identifier");
4544      for (int i = 0; i < array.size(); i++) {
4545        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4546      }
4547    }
4548    ;
4549    if (json.has("instantiatesCanonical")) {
4550      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4551      for (int i = 0; i < array.size(); i++) {
4552        if (array.get(i).isJsonNull()) {
4553          res.getInstantiatesCanonical().add(new CanonicalType());
4554        } else {
4555          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4556        }
4557      }
4558    }
4559    ;
4560    if (json.has("_instantiatesCanonical")) {
4561      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4562      for (int i = 0; i < array.size(); i++) {
4563        if (i == res.getInstantiatesCanonical().size())
4564          res.getInstantiatesCanonical().add(parseCanonical(null));
4565        if (array.get(i) instanceof JsonObject)
4566          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4567      }
4568    }
4569    ;
4570    if (json.has("instantiatesUri")) {
4571      JsonArray array = json.getAsJsonArray("instantiatesUri");
4572      for (int i = 0; i < array.size(); i++) {
4573        if (array.get(i).isJsonNull()) {
4574          res.getInstantiatesUri().add(new UriType());
4575        } else {
4576          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4577        }
4578      }
4579    }
4580    ;
4581    if (json.has("_instantiatesUri")) {
4582      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4583      for (int i = 0; i < array.size(); i++) {
4584        if (i == res.getInstantiatesUri().size())
4585          res.getInstantiatesUri().add(parseUri(null));
4586        if (array.get(i) instanceof JsonObject)
4587          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4588      }
4589    }
4590    ;
4591    if (json.has("basedOn")) {
4592      JsonArray array = json.getAsJsonArray("basedOn");
4593      for (int i = 0; i < array.size(); i++) {
4594        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4595      }
4596    }
4597    ;
4598    if (json.has("replaces")) {
4599      JsonArray array = json.getAsJsonArray("replaces");
4600      for (int i = 0; i < array.size(); i++) {
4601        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4602      }
4603    }
4604    ;
4605    if (json.has("partOf")) {
4606      JsonArray array = json.getAsJsonArray("partOf");
4607      for (int i = 0; i < array.size(); i++) {
4608        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4609      }
4610    }
4611    ;
4612    if (json.has("status"))
4613      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL,
4614          new CarePlan.CarePlanStatusEnumFactory()));
4615    if (json.has("_status"))
4616      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4617    if (json.has("intent"))
4618      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL,
4619          new CarePlan.CarePlanIntentEnumFactory()));
4620    if (json.has("_intent"))
4621      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
4622    if (json.has("category")) {
4623      JsonArray array = json.getAsJsonArray("category");
4624      for (int i = 0; i < array.size(); i++) {
4625        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4626      }
4627    }
4628    ;
4629    if (json.has("title"))
4630      res.setTitleElement(parseString(json.get("title").getAsString()));
4631    if (json.has("_title"))
4632      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4633    if (json.has("description"))
4634      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4635    if (json.has("_description"))
4636      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4637    if (json.has("subject"))
4638      res.setSubject(parseReference(getJObject(json, "subject")));
4639    if (json.has("encounter"))
4640      res.setEncounter(parseReference(getJObject(json, "encounter")));
4641    if (json.has("period"))
4642      res.setPeriod(parsePeriod(getJObject(json, "period")));
4643    if (json.has("created"))
4644      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4645    if (json.has("_created"))
4646      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4647    if (json.has("author"))
4648      res.setAuthor(parseReference(getJObject(json, "author")));
4649    if (json.has("contributor")) {
4650      JsonArray array = json.getAsJsonArray("contributor");
4651      for (int i = 0; i < array.size(); i++) {
4652        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4653      }
4654    }
4655    ;
4656    if (json.has("careTeam")) {
4657      JsonArray array = json.getAsJsonArray("careTeam");
4658      for (int i = 0; i < array.size(); i++) {
4659        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4660      }
4661    }
4662    ;
4663    if (json.has("addresses")) {
4664      JsonArray array = json.getAsJsonArray("addresses");
4665      for (int i = 0; i < array.size(); i++) {
4666        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4667      }
4668    }
4669    ;
4670    if (json.has("supportingInfo")) {
4671      JsonArray array = json.getAsJsonArray("supportingInfo");
4672      for (int i = 0; i < array.size(); i++) {
4673        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4674      }
4675    }
4676    ;
4677    if (json.has("goal")) {
4678      JsonArray array = json.getAsJsonArray("goal");
4679      for (int i = 0; i < array.size(); i++) {
4680        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4681      }
4682    }
4683    ;
4684    if (json.has("activity")) {
4685      JsonArray array = json.getAsJsonArray("activity");
4686      for (int i = 0; i < array.size(); i++) {
4687        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4688      }
4689    }
4690    ;
4691    if (json.has("note")) {
4692      JsonArray array = json.getAsJsonArray("note");
4693      for (int i = 0; i < array.size(); i++) {
4694        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4695      }
4696    }
4697    ;
4698  }
4699
4700  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner)
4701      throws IOException, FHIRFormatError {
4702    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4703    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4704    return res;
4705  }
4706
4707  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner,
4708      CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4709    parseBackboneElementProperties(json, res);
4710    if (json.has("outcomeCodeableConcept")) {
4711      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4712      for (int i = 0; i < array.size(); i++) {
4713        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4714      }
4715    }
4716    ;
4717    if (json.has("outcomeReference")) {
4718      JsonArray array = json.getAsJsonArray("outcomeReference");
4719      for (int i = 0; i < array.size(); i++) {
4720        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4721      }
4722    }
4723    ;
4724    if (json.has("progress")) {
4725      JsonArray array = json.getAsJsonArray("progress");
4726      for (int i = 0; i < array.size(); i++) {
4727        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4728      }
4729    }
4730    ;
4731    if (json.has("reference"))
4732      res.setReference(parseReference(getJObject(json, "reference")));
4733    if (json.has("detail"))
4734      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(getJObject(json, "detail"), owner));
4735  }
4736
4737  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json,
4738      CarePlan owner) throws IOException, FHIRFormatError {
4739    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4740    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4741    return res;
4742  }
4743
4744  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner,
4745      CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4746    parseBackboneElementProperties(json, res);
4747    if (json.has("kind"))
4748      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL,
4749          new CarePlan.CarePlanActivityKindEnumFactory()));
4750    if (json.has("_kind"))
4751      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
4752    if (json.has("instantiatesCanonical")) {
4753      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4754      for (int i = 0; i < array.size(); i++) {
4755        if (array.get(i).isJsonNull()) {
4756          res.getInstantiatesCanonical().add(new CanonicalType());
4757        } else {
4758          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4759        }
4760      }
4761    }
4762    ;
4763    if (json.has("_instantiatesCanonical")) {
4764      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4765      for (int i = 0; i < array.size(); i++) {
4766        if (i == res.getInstantiatesCanonical().size())
4767          res.getInstantiatesCanonical().add(parseCanonical(null));
4768        if (array.get(i) instanceof JsonObject)
4769          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4770      }
4771    }
4772    ;
4773    if (json.has("instantiatesUri")) {
4774      JsonArray array = json.getAsJsonArray("instantiatesUri");
4775      for (int i = 0; i < array.size(); i++) {
4776        if (array.get(i).isJsonNull()) {
4777          res.getInstantiatesUri().add(new UriType());
4778        } else {
4779          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4780        }
4781      }
4782    }
4783    ;
4784    if (json.has("_instantiatesUri")) {
4785      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4786      for (int i = 0; i < array.size(); i++) {
4787        if (i == res.getInstantiatesUri().size())
4788          res.getInstantiatesUri().add(parseUri(null));
4789        if (array.get(i) instanceof JsonObject)
4790          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4791      }
4792    }
4793    ;
4794    if (json.has("code"))
4795      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4796    if (json.has("reasonCode")) {
4797      JsonArray array = json.getAsJsonArray("reasonCode");
4798      for (int i = 0; i < array.size(); i++) {
4799        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4800      }
4801    }
4802    ;
4803    if (json.has("reasonReference")) {
4804      JsonArray array = json.getAsJsonArray("reasonReference");
4805      for (int i = 0; i < array.size(); i++) {
4806        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4807      }
4808    }
4809    ;
4810    if (json.has("goal")) {
4811      JsonArray array = json.getAsJsonArray("goal");
4812      for (int i = 0; i < array.size(); i++) {
4813        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4814      }
4815    }
4816    ;
4817    if (json.has("status"))
4818      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL,
4819          new CarePlan.CarePlanActivityStatusEnumFactory()));
4820    if (json.has("_status"))
4821      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4822    if (json.has("statusReason"))
4823      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
4824    if (json.has("doNotPerform"))
4825      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4826    if (json.has("_doNotPerform"))
4827      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
4828    Type scheduled = parseType("scheduled", json);
4829    if (scheduled != null)
4830      res.setScheduled(scheduled);
4831    if (json.has("location"))
4832      res.setLocation(parseReference(getJObject(json, "location")));
4833    if (json.has("performer")) {
4834      JsonArray array = json.getAsJsonArray("performer");
4835      for (int i = 0; i < array.size(); i++) {
4836        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4837      }
4838    }
4839    ;
4840    Type product = parseType("product", json);
4841    if (product != null)
4842      res.setProduct(product);
4843    if (json.has("dailyAmount"))
4844      res.setDailyAmount(parseQuantity(getJObject(json, "dailyAmount")));
4845    if (json.has("quantity"))
4846      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4847    if (json.has("description"))
4848      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4849    if (json.has("_description"))
4850      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4851  }
4852
4853  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4854    CareTeam res = new CareTeam();
4855    parseCareTeamProperties(json, res);
4856    return res;
4857  }
4858
4859  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4860    parseDomainResourceProperties(json, res);
4861    if (json.has("identifier")) {
4862      JsonArray array = json.getAsJsonArray("identifier");
4863      for (int i = 0; i < array.size(); i++) {
4864        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4865      }
4866    }
4867    ;
4868    if (json.has("status"))
4869      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL,
4870          new CareTeam.CareTeamStatusEnumFactory()));
4871    if (json.has("_status"))
4872      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4873    if (json.has("category")) {
4874      JsonArray array = json.getAsJsonArray("category");
4875      for (int i = 0; i < array.size(); i++) {
4876        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4877      }
4878    }
4879    ;
4880    if (json.has("name"))
4881      res.setNameElement(parseString(json.get("name").getAsString()));
4882    if (json.has("_name"))
4883      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4884    if (json.has("subject"))
4885      res.setSubject(parseReference(getJObject(json, "subject")));
4886    if (json.has("encounter"))
4887      res.setEncounter(parseReference(getJObject(json, "encounter")));
4888    if (json.has("period"))
4889      res.setPeriod(parsePeriod(getJObject(json, "period")));
4890    if (json.has("participant")) {
4891      JsonArray array = json.getAsJsonArray("participant");
4892      for (int i = 0; i < array.size(); i++) {
4893        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
4894      }
4895    }
4896    ;
4897    if (json.has("reasonCode")) {
4898      JsonArray array = json.getAsJsonArray("reasonCode");
4899      for (int i = 0; i < array.size(); i++) {
4900        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4901      }
4902    }
4903    ;
4904    if (json.has("reasonReference")) {
4905      JsonArray array = json.getAsJsonArray("reasonReference");
4906      for (int i = 0; i < array.size(); i++) {
4907        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4908      }
4909    }
4910    ;
4911    if (json.has("managingOrganization")) {
4912      JsonArray array = json.getAsJsonArray("managingOrganization");
4913      for (int i = 0; i < array.size(); i++) {
4914        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4915      }
4916    }
4917    ;
4918    if (json.has("telecom")) {
4919      JsonArray array = json.getAsJsonArray("telecom");
4920      for (int i = 0; i < array.size(); i++) {
4921        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4922      }
4923    }
4924    ;
4925    if (json.has("note")) {
4926      JsonArray array = json.getAsJsonArray("note");
4927      for (int i = 0; i < array.size(); i++) {
4928        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4929      }
4930    }
4931    ;
4932  }
4933
4934  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json,
4935      CareTeam owner) throws IOException, FHIRFormatError {
4936    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4937    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
4938    return res;
4939  }
4940
4941  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner,
4942      CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4943    parseBackboneElementProperties(json, res);
4944    if (json.has("role")) {
4945      JsonArray array = json.getAsJsonArray("role");
4946      for (int i = 0; i < array.size(); i++) {
4947        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4948      }
4949    }
4950    ;
4951    if (json.has("member"))
4952      res.setMember(parseReference(getJObject(json, "member")));
4953    if (json.has("onBehalfOf"))
4954      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
4955    if (json.has("period"))
4956      res.setPeriod(parsePeriod(getJObject(json, "period")));
4957  }
4958
4959  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
4960    CatalogEntry res = new CatalogEntry();
4961    parseCatalogEntryProperties(json, res);
4962    return res;
4963  }
4964
4965  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
4966    parseDomainResourceProperties(json, res);
4967    if (json.has("identifier")) {
4968      JsonArray array = json.getAsJsonArray("identifier");
4969      for (int i = 0; i < array.size(); i++) {
4970        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4971      }
4972    }
4973    ;
4974    if (json.has("type"))
4975      res.setType(parseCodeableConcept(getJObject(json, "type")));
4976    if (json.has("orderable"))
4977      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
4978    if (json.has("_orderable"))
4979      parseElementProperties(getJObject(json, "_orderable"), res.getOrderableElement());
4980    if (json.has("referencedItem"))
4981      res.setReferencedItem(parseReference(getJObject(json, "referencedItem")));
4982    if (json.has("additionalIdentifier")) {
4983      JsonArray array = json.getAsJsonArray("additionalIdentifier");
4984      for (int i = 0; i < array.size(); i++) {
4985        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4986      }
4987    }
4988    ;
4989    if (json.has("classification")) {
4990      JsonArray array = json.getAsJsonArray("classification");
4991      for (int i = 0; i < array.size(); i++) {
4992        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4993      }
4994    }
4995    ;
4996    if (json.has("status"))
4997      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
4998          new Enumerations.PublicationStatusEnumFactory()));
4999    if (json.has("_status"))
5000      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5001    if (json.has("validityPeriod"))
5002      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
5003    if (json.has("validTo"))
5004      res.setValidToElement(parseDateTime(json.get("validTo").getAsString()));
5005    if (json.has("_validTo"))
5006      parseElementProperties(getJObject(json, "_validTo"), res.getValidToElement());
5007    if (json.has("lastUpdated"))
5008      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
5009    if (json.has("_lastUpdated"))
5010      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
5011    if (json.has("additionalCharacteristic")) {
5012      JsonArray array = json.getAsJsonArray("additionalCharacteristic");
5013      for (int i = 0; i < array.size(); i++) {
5014        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5015      }
5016    }
5017    ;
5018    if (json.has("additionalClassification")) {
5019      JsonArray array = json.getAsJsonArray("additionalClassification");
5020      for (int i = 0; i < array.size(); i++) {
5021        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5022      }
5023    }
5024    ;
5025    if (json.has("relatedEntry")) {
5026      JsonArray array = json.getAsJsonArray("relatedEntry");
5027      for (int i = 0; i < array.size(); i++) {
5028        res.getRelatedEntry()
5029            .add(parseCatalogEntryCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
5030      }
5031    }
5032    ;
5033  }
5034
5035  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(
5036      JsonObject json, CatalogEntry owner) throws IOException, FHIRFormatError {
5037    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
5038    parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(json, owner, res);
5039    return res;
5040  }
5041
5042  protected void parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry owner,
5043      CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
5044    parseBackboneElementProperties(json, res);
5045    if (json.has("relationtype"))
5046      res.setRelationtypeElement(parseEnumeration(json.get("relationtype").getAsString(),
5047          CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
5048    if (json.has("_relationtype"))
5049      parseElementProperties(getJObject(json, "_relationtype"), res.getRelationtypeElement());
5050    if (json.has("item"))
5051      res.setItem(parseReference(getJObject(json, "item")));
5052  }
5053
5054  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
5055    ChargeItem res = new ChargeItem();
5056    parseChargeItemProperties(json, res);
5057    return res;
5058  }
5059
5060  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
5061    parseDomainResourceProperties(json, res);
5062    if (json.has("identifier")) {
5063      JsonArray array = json.getAsJsonArray("identifier");
5064      for (int i = 0; i < array.size(); i++) {
5065        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5066      }
5067    }
5068    ;
5069    if (json.has("definitionUri")) {
5070      JsonArray array = json.getAsJsonArray("definitionUri");
5071      for (int i = 0; i < array.size(); i++) {
5072        if (array.get(i).isJsonNull()) {
5073          res.getDefinitionUri().add(new UriType());
5074        } else {
5075          res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
5076        }
5077      }
5078    }
5079    ;
5080    if (json.has("_definitionUri")) {
5081      JsonArray array = json.getAsJsonArray("_definitionUri");
5082      for (int i = 0; i < array.size(); i++) {
5083        if (i == res.getDefinitionUri().size())
5084          res.getDefinitionUri().add(parseUri(null));
5085        if (array.get(i) instanceof JsonObject)
5086          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
5087      }
5088    }
5089    ;
5090    if (json.has("definitionCanonical")) {
5091      JsonArray array = json.getAsJsonArray("definitionCanonical");
5092      for (int i = 0; i < array.size(); i++) {
5093        if (array.get(i).isJsonNull()) {
5094          res.getDefinitionCanonical().add(new CanonicalType());
5095        } else {
5096          res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
5097        }
5098      }
5099    }
5100    ;
5101    if (json.has("_definitionCanonical")) {
5102      JsonArray array = json.getAsJsonArray("_definitionCanonical");
5103      for (int i = 0; i < array.size(); i++) {
5104        if (i == res.getDefinitionCanonical().size())
5105          res.getDefinitionCanonical().add(parseCanonical(null));
5106        if (array.get(i) instanceof JsonObject)
5107          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
5108      }
5109    }
5110    ;
5111    if (json.has("status"))
5112      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL,
5113          new ChargeItem.ChargeItemStatusEnumFactory()));
5114    if (json.has("_status"))
5115      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5116    if (json.has("partOf")) {
5117      JsonArray array = json.getAsJsonArray("partOf");
5118      for (int i = 0; i < array.size(); i++) {
5119        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5120      }
5121    }
5122    ;
5123    if (json.has("code"))
5124      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5125    if (json.has("subject"))
5126      res.setSubject(parseReference(getJObject(json, "subject")));
5127    if (json.has("context"))
5128      res.setContext(parseReference(getJObject(json, "context")));
5129    Type occurrence = parseType("occurrence", json);
5130    if (occurrence != null)
5131      res.setOccurrence(occurrence);
5132    if (json.has("performer")) {
5133      JsonArray array = json.getAsJsonArray("performer");
5134      for (int i = 0; i < array.size(); i++) {
5135        res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(array.get(i).getAsJsonObject(), res));
5136      }
5137    }
5138    ;
5139    if (json.has("performingOrganization"))
5140      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
5141    if (json.has("requestingOrganization"))
5142      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
5143    if (json.has("costCenter"))
5144      res.setCostCenter(parseReference(getJObject(json, "costCenter")));
5145    if (json.has("quantity"))
5146      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5147    if (json.has("bodysite")) {
5148      JsonArray array = json.getAsJsonArray("bodysite");
5149      for (int i = 0; i < array.size(); i++) {
5150        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5151      }
5152    }
5153    ;
5154    if (json.has("factorOverride"))
5155      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
5156    if (json.has("_factorOverride"))
5157      parseElementProperties(getJObject(json, "_factorOverride"), res.getFactorOverrideElement());
5158    if (json.has("priceOverride"))
5159      res.setPriceOverride(parseMoney(getJObject(json, "priceOverride")));
5160    if (json.has("overrideReason"))
5161      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
5162    if (json.has("_overrideReason"))
5163      parseElementProperties(getJObject(json, "_overrideReason"), res.getOverrideReasonElement());
5164    if (json.has("enterer"))
5165      res.setEnterer(parseReference(getJObject(json, "enterer")));
5166    if (json.has("enteredDate"))
5167      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
5168    if (json.has("_enteredDate"))
5169      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
5170    if (json.has("reason")) {
5171      JsonArray array = json.getAsJsonArray("reason");
5172      for (int i = 0; i < array.size(); i++) {
5173        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5174      }
5175    }
5176    ;
5177    if (json.has("service")) {
5178      JsonArray array = json.getAsJsonArray("service");
5179      for (int i = 0; i < array.size(); i++) {
5180        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
5181      }
5182    }
5183    ;
5184    Type product = parseType("product", json);
5185    if (product != null)
5186      res.setProduct(product);
5187    if (json.has("account")) {
5188      JsonArray array = json.getAsJsonArray("account");
5189      for (int i = 0; i < array.size(); i++) {
5190        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
5191      }
5192    }
5193    ;
5194    if (json.has("note")) {
5195      JsonArray array = json.getAsJsonArray("note");
5196      for (int i = 0; i < array.size(); i++) {
5197        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5198      }
5199    }
5200    ;
5201    if (json.has("supportingInformation")) {
5202      JsonArray array = json.getAsJsonArray("supportingInformation");
5203      for (int i = 0; i < array.size(); i++) {
5204        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
5205      }
5206    }
5207    ;
5208  }
5209
5210  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(JsonObject json,
5211      ChargeItem owner) throws IOException, FHIRFormatError {
5212    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
5213    parseChargeItemChargeItemPerformerComponentProperties(json, owner, res);
5214    return res;
5215  }
5216
5217  protected void parseChargeItemChargeItemPerformerComponentProperties(JsonObject json, ChargeItem owner,
5218      ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
5219    parseBackboneElementProperties(json, res);
5220    if (json.has("function"))
5221      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
5222    if (json.has("actor"))
5223      res.setActor(parseReference(getJObject(json, "actor")));
5224  }
5225
5226  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
5227    ChargeItemDefinition res = new ChargeItemDefinition();
5228    parseChargeItemDefinitionProperties(json, res);
5229    return res;
5230  }
5231
5232  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res)
5233      throws IOException, FHIRFormatError {
5234    parseDomainResourceProperties(json, res);
5235    if (json.has("url"))
5236      res.setUrlElement(parseUri(json.get("url").getAsString()));
5237    if (json.has("_url"))
5238      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5239    if (json.has("identifier")) {
5240      JsonArray array = json.getAsJsonArray("identifier");
5241      for (int i = 0; i < array.size(); i++) {
5242        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5243      }
5244    }
5245    ;
5246    if (json.has("version"))
5247      res.setVersionElement(parseString(json.get("version").getAsString()));
5248    if (json.has("_version"))
5249      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5250    if (json.has("title"))
5251      res.setTitleElement(parseString(json.get("title").getAsString()));
5252    if (json.has("_title"))
5253      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5254    if (json.has("derivedFromUri")) {
5255      JsonArray array = json.getAsJsonArray("derivedFromUri");
5256      for (int i = 0; i < array.size(); i++) {
5257        if (array.get(i).isJsonNull()) {
5258          res.getDerivedFromUri().add(new UriType());
5259        } else {
5260          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
5261        }
5262      }
5263    }
5264    ;
5265    if (json.has("_derivedFromUri")) {
5266      JsonArray array = json.getAsJsonArray("_derivedFromUri");
5267      for (int i = 0; i < array.size(); i++) {
5268        if (i == res.getDerivedFromUri().size())
5269          res.getDerivedFromUri().add(parseUri(null));
5270        if (array.get(i) instanceof JsonObject)
5271          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
5272      }
5273    }
5274    ;
5275    if (json.has("partOf")) {
5276      JsonArray array = json.getAsJsonArray("partOf");
5277      for (int i = 0; i < array.size(); i++) {
5278        if (array.get(i).isJsonNull()) {
5279          res.getPartOf().add(new CanonicalType());
5280        } else {
5281          res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
5282        }
5283      }
5284    }
5285    ;
5286    if (json.has("_partOf")) {
5287      JsonArray array = json.getAsJsonArray("_partOf");
5288      for (int i = 0; i < array.size(); i++) {
5289        if (i == res.getPartOf().size())
5290          res.getPartOf().add(parseCanonical(null));
5291        if (array.get(i) instanceof JsonObject)
5292          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
5293      }
5294    }
5295    ;
5296    if (json.has("replaces")) {
5297      JsonArray array = json.getAsJsonArray("replaces");
5298      for (int i = 0; i < array.size(); i++) {
5299        if (array.get(i).isJsonNull()) {
5300          res.getReplaces().add(new CanonicalType());
5301        } else {
5302          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
5303        }
5304      }
5305    }
5306    ;
5307    if (json.has("_replaces")) {
5308      JsonArray array = json.getAsJsonArray("_replaces");
5309      for (int i = 0; i < array.size(); i++) {
5310        if (i == res.getReplaces().size())
5311          res.getReplaces().add(parseCanonical(null));
5312        if (array.get(i) instanceof JsonObject)
5313          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
5314      }
5315    }
5316    ;
5317    if (json.has("status"))
5318      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
5319          new Enumerations.PublicationStatusEnumFactory()));
5320    if (json.has("_status"))
5321      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5322    if (json.has("experimental"))
5323      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5324    if (json.has("_experimental"))
5325      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5326    if (json.has("date"))
5327      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5328    if (json.has("_date"))
5329      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5330    if (json.has("publisher"))
5331      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5332    if (json.has("_publisher"))
5333      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5334    if (json.has("contact")) {
5335      JsonArray array = json.getAsJsonArray("contact");
5336      for (int i = 0; i < array.size(); i++) {
5337        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5338      }
5339    }
5340    ;
5341    if (json.has("description"))
5342      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5343    if (json.has("_description"))
5344      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5345    if (json.has("useContext")) {
5346      JsonArray array = json.getAsJsonArray("useContext");
5347      for (int i = 0; i < array.size(); i++) {
5348        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5349      }
5350    }
5351    ;
5352    if (json.has("jurisdiction")) {
5353      JsonArray array = json.getAsJsonArray("jurisdiction");
5354      for (int i = 0; i < array.size(); i++) {
5355        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5356      }
5357    }
5358    ;
5359    if (json.has("copyright"))
5360      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5361    if (json.has("_copyright"))
5362      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5363    if (json.has("approvalDate"))
5364      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5365    if (json.has("_approvalDate"))
5366      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
5367    if (json.has("lastReviewDate"))
5368      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5369    if (json.has("_lastReviewDate"))
5370      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
5371    if (json.has("effectivePeriod"))
5372      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
5373    if (json.has("code"))
5374      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5375    if (json.has("instance")) {
5376      JsonArray array = json.getAsJsonArray("instance");
5377      for (int i = 0; i < array.size(); i++) {
5378        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
5379      }
5380    }
5381    ;
5382    if (json.has("applicability")) {
5383      JsonArray array = json.getAsJsonArray("applicability");
5384      for (int i = 0; i < array.size(); i++) {
5385        res.getApplicability().add(
5386            parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), res));
5387      }
5388    }
5389    ;
5390    if (json.has("propertyGroup")) {
5391      JsonArray array = json.getAsJsonArray("propertyGroup");
5392      for (int i = 0; i < array.size(); i++) {
5393        res.getPropertyGroup().add(
5394            parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject(), res));
5395      }
5396    }
5397    ;
5398  }
5399
5400  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(
5401      JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
5402    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
5403    parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(json, owner, res);
5404    return res;
5405  }
5406
5407  protected void parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(JsonObject json,
5408      ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res)
5409      throws IOException, FHIRFormatError {
5410    parseBackboneElementProperties(json, res);
5411    if (json.has("description"))
5412      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5413    if (json.has("_description"))
5414      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5415    if (json.has("language"))
5416      res.setLanguageElement(parseString(json.get("language").getAsString()));
5417    if (json.has("_language"))
5418      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
5419    if (json.has("expression"))
5420      res.setExpressionElement(parseString(json.get("expression").getAsString()));
5421    if (json.has("_expression"))
5422      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
5423  }
5424
5425  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(
5426      JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
5427    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
5428    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(json, owner, res);
5429    return res;
5430  }
5431
5432  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json,
5433      ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res)
5434      throws IOException, FHIRFormatError {
5435    parseBackboneElementProperties(json, res);
5436    if (json.has("applicability")) {
5437      JsonArray array = json.getAsJsonArray("applicability");
5438      for (int i = 0; i < array.size(); i++) {
5439        res.getApplicability().add(
5440            parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), owner));
5441      }
5442    }
5443    ;
5444    if (json.has("priceComponent")) {
5445      JsonArray array = json.getAsJsonArray("priceComponent");
5446      for (int i = 0; i < array.size(); i++) {
5447        res.getPriceComponent().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(
5448            array.get(i).getAsJsonObject(), owner));
5449      }
5450    }
5451    ;
5452  }
5453
5454  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(
5455      JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
5456    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
5457    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, owner, res);
5458    return res;
5459  }
5460
5461  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(
5462      JsonObject json, ChargeItemDefinition owner,
5463      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res)
5464      throws IOException, FHIRFormatError {
5465    parseBackboneElementProperties(json, res);
5466    if (json.has("type"))
5467      res.setTypeElement(parseEnumeration(json.get("type").getAsString(),
5468          ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL,
5469          new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
5470    if (json.has("_type"))
5471      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5472    if (json.has("code"))
5473      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5474    if (json.has("factor"))
5475      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5476    if (json.has("_factor"))
5477      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5478    if (json.has("amount"))
5479      res.setAmount(parseMoney(getJObject(json, "amount")));
5480  }
5481
5482  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
5483    Claim res = new Claim();
5484    parseClaimProperties(json, res);
5485    return res;
5486  }
5487
5488  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
5489    parseDomainResourceProperties(json, res);
5490    if (json.has("identifier")) {
5491      JsonArray array = json.getAsJsonArray("identifier");
5492      for (int i = 0; i < array.size(); i++) {
5493        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5494      }
5495    }
5496    ;
5497    if (json.has("status"))
5498      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL,
5499          new Claim.ClaimStatusEnumFactory()));
5500    if (json.has("_status"))
5501      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5502    if (json.has("type"))
5503      res.setType(parseCodeableConcept(getJObject(json, "type")));
5504    if (json.has("subType"))
5505      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
5506    if (json.has("use"))
5507      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
5508    if (json.has("_use"))
5509      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
5510    if (json.has("patient"))
5511      res.setPatient(parseReference(getJObject(json, "patient")));
5512    if (json.has("billablePeriod"))
5513      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
5514    if (json.has("created"))
5515      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5516    if (json.has("_created"))
5517      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
5518    if (json.has("enterer"))
5519      res.setEnterer(parseReference(getJObject(json, "enterer")));
5520    if (json.has("insurer"))
5521      res.setInsurer(parseReference(getJObject(json, "insurer")));
5522    if (json.has("provider"))
5523      res.setProvider(parseReference(getJObject(json, "provider")));
5524    if (json.has("priority"))
5525      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
5526    if (json.has("fundsReserve"))
5527      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
5528    if (json.has("related")) {
5529      JsonArray array = json.getAsJsonArray("related");
5530      for (int i = 0; i < array.size(); i++) {
5531        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
5532      }
5533    }
5534    ;
5535    if (json.has("prescription"))
5536      res.setPrescription(parseReference(getJObject(json, "prescription")));
5537    if (json.has("originalPrescription"))
5538      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
5539    if (json.has("payee"))
5540      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee"), res));
5541    if (json.has("referral"))
5542      res.setReferral(parseReference(getJObject(json, "referral")));
5543    if (json.has("facility"))
5544      res.setFacility(parseReference(getJObject(json, "facility")));
5545    if (json.has("careTeam")) {
5546      JsonArray array = json.getAsJsonArray("careTeam");
5547      for (int i = 0; i < array.size(); i++) {
5548        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
5549      }
5550    }
5551    ;
5552    if (json.has("supportingInfo")) {
5553      JsonArray array = json.getAsJsonArray("supportingInfo");
5554      for (int i = 0; i < array.size(); i++) {
5555        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
5556      }
5557    }
5558    ;
5559    if (json.has("diagnosis")) {
5560      JsonArray array = json.getAsJsonArray("diagnosis");
5561      for (int i = 0; i < array.size(); i++) {
5562        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
5563      }
5564    }
5565    ;
5566    if (json.has("procedure")) {
5567      JsonArray array = json.getAsJsonArray("procedure");
5568      for (int i = 0; i < array.size(); i++) {
5569        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
5570      }
5571    }
5572    ;
5573    if (json.has("insurance")) {
5574      JsonArray array = json.getAsJsonArray("insurance");
5575      for (int i = 0; i < array.size(); i++) {
5576        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
5577      }
5578    }
5579    ;
5580    if (json.has("accident"))
5581      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident"), res));
5582    if (json.has("item")) {
5583      JsonArray array = json.getAsJsonArray("item");
5584      for (int i = 0; i < array.size(); i++) {
5585        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
5586      }
5587    }
5588    ;
5589    if (json.has("total"))
5590      res.setTotal(parseMoney(getJObject(json, "total")));
5591  }
5592
5593  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner)
5594      throws IOException, FHIRFormatError {
5595    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
5596    parseClaimRelatedClaimComponentProperties(json, owner, res);
5597    return res;
5598  }
5599
5600  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner,
5601      Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
5602    parseBackboneElementProperties(json, res);
5603    if (json.has("claim"))
5604      res.setClaim(parseReference(getJObject(json, "claim")));
5605    if (json.has("relationship"))
5606      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
5607    if (json.has("reference"))
5608      res.setReference(parseIdentifier(getJObject(json, "reference")));
5609  }
5610
5611  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner)
5612      throws IOException, FHIRFormatError {
5613    Claim.PayeeComponent res = new Claim.PayeeComponent();
5614    parseClaimPayeeComponentProperties(json, owner, res);
5615    return res;
5616  }
5617
5618  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res)
5619      throws IOException, FHIRFormatError {
5620    parseBackboneElementProperties(json, res);
5621    if (json.has("type"))
5622      res.setType(parseCodeableConcept(getJObject(json, "type")));
5623    if (json.has("party"))
5624      res.setParty(parseReference(getJObject(json, "party")));
5625  }
5626
5627  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner)
5628      throws IOException, FHIRFormatError {
5629    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
5630    parseClaimCareTeamComponentProperties(json, owner, res);
5631    return res;
5632  }
5633
5634  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res)
5635      throws IOException, FHIRFormatError {
5636    parseBackboneElementProperties(json, res);
5637    if (json.has("sequence"))
5638      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5639    if (json.has("_sequence"))
5640      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5641    if (json.has("provider"))
5642      res.setProvider(parseReference(getJObject(json, "provider")));
5643    if (json.has("responsible"))
5644      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
5645    if (json.has("_responsible"))
5646      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
5647    if (json.has("role"))
5648      res.setRole(parseCodeableConcept(getJObject(json, "role")));
5649    if (json.has("qualification"))
5650      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
5651  }
5652
5653  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json, Claim owner)
5654      throws IOException, FHIRFormatError {
5655    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
5656    parseClaimSupportingInformationComponentProperties(json, owner, res);
5657    return res;
5658  }
5659
5660  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim owner,
5661      Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
5662    parseBackboneElementProperties(json, res);
5663    if (json.has("sequence"))
5664      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5665    if (json.has("_sequence"))
5666      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5667    if (json.has("category"))
5668      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5669    if (json.has("code"))
5670      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5671    Type timing = parseType("timing", json);
5672    if (timing != null)
5673      res.setTiming(timing);
5674    Type value = parseType("value", json);
5675    if (value != null)
5676      res.setValue(value);
5677    if (json.has("reason"))
5678      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
5679  }
5680
5681  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner)
5682      throws IOException, FHIRFormatError {
5683    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
5684    parseClaimDiagnosisComponentProperties(json, owner, res);
5685    return res;
5686  }
5687
5688  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res)
5689      throws IOException, FHIRFormatError {
5690    parseBackboneElementProperties(json, res);
5691    if (json.has("sequence"))
5692      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5693    if (json.has("_sequence"))
5694      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5695    Type diagnosis = parseType("diagnosis", json);
5696    if (diagnosis != null)
5697      res.setDiagnosis(diagnosis);
5698    if (json.has("type")) {
5699      JsonArray array = json.getAsJsonArray("type");
5700      for (int i = 0; i < array.size(); i++) {
5701        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5702      }
5703    }
5704    ;
5705    if (json.has("onAdmission"))
5706      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
5707    if (json.has("packageCode"))
5708      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
5709  }
5710
5711  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner)
5712      throws IOException, FHIRFormatError {
5713    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
5714    parseClaimProcedureComponentProperties(json, owner, res);
5715    return res;
5716  }
5717
5718  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res)
5719      throws IOException, FHIRFormatError {
5720    parseBackboneElementProperties(json, res);
5721    if (json.has("sequence"))
5722      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5723    if (json.has("_sequence"))
5724      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5725    if (json.has("type")) {
5726      JsonArray array = json.getAsJsonArray("type");
5727      for (int i = 0; i < array.size(); i++) {
5728        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5729      }
5730    }
5731    ;
5732    if (json.has("date"))
5733      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5734    if (json.has("_date"))
5735      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5736    Type procedure = parseType("procedure", json);
5737    if (procedure != null)
5738      res.setProcedure(procedure);
5739    if (json.has("udi")) {
5740      JsonArray array = json.getAsJsonArray("udi");
5741      for (int i = 0; i < array.size(); i++) {
5742        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5743      }
5744    }
5745    ;
5746  }
5747
5748  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner)
5749      throws IOException, FHIRFormatError {
5750    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
5751    parseClaimInsuranceComponentProperties(json, owner, res);
5752    return res;
5753  }
5754
5755  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res)
5756      throws IOException, FHIRFormatError {
5757    parseBackboneElementProperties(json, res);
5758    if (json.has("sequence"))
5759      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5760    if (json.has("_sequence"))
5761      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5762    if (json.has("focal"))
5763      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5764    if (json.has("_focal"))
5765      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
5766    if (json.has("identifier"))
5767      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5768    if (json.has("coverage"))
5769      res.setCoverage(parseReference(getJObject(json, "coverage")));
5770    if (json.has("businessArrangement"))
5771      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5772    if (json.has("_businessArrangement"))
5773      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
5774    if (json.has("preAuthRef")) {
5775      JsonArray array = json.getAsJsonArray("preAuthRef");
5776      for (int i = 0; i < array.size(); i++) {
5777        if (array.get(i).isJsonNull()) {
5778          res.getPreAuthRef().add(new StringType());
5779        } else {
5780          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5781        }
5782      }
5783    }
5784    ;
5785    if (json.has("_preAuthRef")) {
5786      JsonArray array = json.getAsJsonArray("_preAuthRef");
5787      for (int i = 0; i < array.size(); i++) {
5788        if (i == res.getPreAuthRef().size())
5789          res.getPreAuthRef().add(parseString(null));
5790        if (array.get(i) instanceof JsonObject)
5791          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5792      }
5793    }
5794    ;
5795    if (json.has("claimResponse"))
5796      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
5797  }
5798
5799  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner)
5800      throws IOException, FHIRFormatError {
5801    Claim.AccidentComponent res = new Claim.AccidentComponent();
5802    parseClaimAccidentComponentProperties(json, owner, res);
5803    return res;
5804  }
5805
5806  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res)
5807      throws IOException, FHIRFormatError {
5808    parseBackboneElementProperties(json, res);
5809    if (json.has("date"))
5810      res.setDateElement(parseDate(json.get("date").getAsString()));
5811    if (json.has("_date"))
5812      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5813    if (json.has("type"))
5814      res.setType(parseCodeableConcept(getJObject(json, "type")));
5815    Type location = parseType("location", json);
5816    if (location != null)
5817      res.setLocation(location);
5818  }
5819
5820  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner)
5821      throws IOException, FHIRFormatError {
5822    Claim.ItemComponent res = new Claim.ItemComponent();
5823    parseClaimItemComponentProperties(json, owner, res);
5824    return res;
5825  }
5826
5827  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res)
5828      throws IOException, FHIRFormatError {
5829    parseBackboneElementProperties(json, res);
5830    if (json.has("sequence"))
5831      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5832    if (json.has("_sequence"))
5833      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5834    if (json.has("careTeamSequence")) {
5835      JsonArray array = json.getAsJsonArray("careTeamSequence");
5836      for (int i = 0; i < array.size(); i++) {
5837        if (array.get(i).isJsonNull()) {
5838          res.getCareTeamSequence().add(new PositiveIntType());
5839        } else {
5840          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
5841        }
5842      }
5843    }
5844    ;
5845    if (json.has("_careTeamSequence")) {
5846      JsonArray array = json.getAsJsonArray("_careTeamSequence");
5847      for (int i = 0; i < array.size(); i++) {
5848        if (i == res.getCareTeamSequence().size())
5849          res.getCareTeamSequence().add(parsePositiveInt(null));
5850        if (array.get(i) instanceof JsonObject)
5851          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
5852      }
5853    }
5854    ;
5855    if (json.has("diagnosisSequence")) {
5856      JsonArray array = json.getAsJsonArray("diagnosisSequence");
5857      for (int i = 0; i < array.size(); i++) {
5858        if (array.get(i).isJsonNull()) {
5859          res.getDiagnosisSequence().add(new PositiveIntType());
5860        } else {
5861          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
5862        }
5863      }
5864    }
5865    ;
5866    if (json.has("_diagnosisSequence")) {
5867      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
5868      for (int i = 0; i < array.size(); i++) {
5869        if (i == res.getDiagnosisSequence().size())
5870          res.getDiagnosisSequence().add(parsePositiveInt(null));
5871        if (array.get(i) instanceof JsonObject)
5872          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
5873      }
5874    }
5875    ;
5876    if (json.has("procedureSequence")) {
5877      JsonArray array = json.getAsJsonArray("procedureSequence");
5878      for (int i = 0; i < array.size(); i++) {
5879        if (array.get(i).isJsonNull()) {
5880          res.getProcedureSequence().add(new PositiveIntType());
5881        } else {
5882          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
5883        }
5884      }
5885    }
5886    ;
5887    if (json.has("_procedureSequence")) {
5888      JsonArray array = json.getAsJsonArray("_procedureSequence");
5889      for (int i = 0; i < array.size(); i++) {
5890        if (i == res.getProcedureSequence().size())
5891          res.getProcedureSequence().add(parsePositiveInt(null));
5892        if (array.get(i) instanceof JsonObject)
5893          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
5894      }
5895    }
5896    ;
5897    if (json.has("informationSequence")) {
5898      JsonArray array = json.getAsJsonArray("informationSequence");
5899      for (int i = 0; i < array.size(); i++) {
5900        if (array.get(i).isJsonNull()) {
5901          res.getInformationSequence().add(new PositiveIntType());
5902        } else {
5903          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
5904        }
5905      }
5906    }
5907    ;
5908    if (json.has("_informationSequence")) {
5909      JsonArray array = json.getAsJsonArray("_informationSequence");
5910      for (int i = 0; i < array.size(); i++) {
5911        if (i == res.getInformationSequence().size())
5912          res.getInformationSequence().add(parsePositiveInt(null));
5913        if (array.get(i) instanceof JsonObject)
5914          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
5915      }
5916    }
5917    ;
5918    if (json.has("revenue"))
5919      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
5920    if (json.has("category"))
5921      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5922    if (json.has("productOrService"))
5923      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5924    if (json.has("modifier")) {
5925      JsonArray array = json.getAsJsonArray("modifier");
5926      for (int i = 0; i < array.size(); i++) {
5927        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5928      }
5929    }
5930    ;
5931    if (json.has("programCode")) {
5932      JsonArray array = json.getAsJsonArray("programCode");
5933      for (int i = 0; i < array.size(); i++) {
5934        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5935      }
5936    }
5937    ;
5938    Type serviced = parseType("serviced", json);
5939    if (serviced != null)
5940      res.setServiced(serviced);
5941    Type location = parseType("location", json);
5942    if (location != null)
5943      res.setLocation(location);
5944    if (json.has("quantity"))
5945      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5946    if (json.has("unitPrice"))
5947      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5948    if (json.has("factor"))
5949      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5950    if (json.has("_factor"))
5951      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5952    if (json.has("net"))
5953      res.setNet(parseMoney(getJObject(json, "net")));
5954    if (json.has("udi")) {
5955      JsonArray array = json.getAsJsonArray("udi");
5956      for (int i = 0; i < array.size(); i++) {
5957        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5958      }
5959    }
5960    ;
5961    if (json.has("bodySite"))
5962      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
5963    if (json.has("subSite")) {
5964      JsonArray array = json.getAsJsonArray("subSite");
5965      for (int i = 0; i < array.size(); i++) {
5966        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5967      }
5968    }
5969    ;
5970    if (json.has("encounter")) {
5971      JsonArray array = json.getAsJsonArray("encounter");
5972      for (int i = 0; i < array.size(); i++) {
5973        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
5974      }
5975    }
5976    ;
5977    if (json.has("detail")) {
5978      JsonArray array = json.getAsJsonArray("detail");
5979      for (int i = 0; i < array.size(); i++) {
5980        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
5981      }
5982    }
5983    ;
5984  }
5985
5986  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner)
5987      throws IOException, FHIRFormatError {
5988    Claim.DetailComponent res = new Claim.DetailComponent();
5989    parseClaimDetailComponentProperties(json, owner, res);
5990    return res;
5991  }
5992
5993  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res)
5994      throws IOException, FHIRFormatError {
5995    parseBackboneElementProperties(json, res);
5996    if (json.has("sequence"))
5997      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5998    if (json.has("_sequence"))
5999      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6000    if (json.has("revenue"))
6001      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6002    if (json.has("category"))
6003      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6004    if (json.has("productOrService"))
6005      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6006    if (json.has("modifier")) {
6007      JsonArray array = json.getAsJsonArray("modifier");
6008      for (int i = 0; i < array.size(); i++) {
6009        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6010      }
6011    }
6012    ;
6013    if (json.has("programCode")) {
6014      JsonArray array = json.getAsJsonArray("programCode");
6015      for (int i = 0; i < array.size(); i++) {
6016        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6017      }
6018    }
6019    ;
6020    if (json.has("quantity"))
6021      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6022    if (json.has("unitPrice"))
6023      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6024    if (json.has("factor"))
6025      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6026    if (json.has("_factor"))
6027      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6028    if (json.has("net"))
6029      res.setNet(parseMoney(getJObject(json, "net")));
6030    if (json.has("udi")) {
6031      JsonArray array = json.getAsJsonArray("udi");
6032      for (int i = 0; i < array.size(); i++) {
6033        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6034      }
6035    }
6036    ;
6037    if (json.has("subDetail")) {
6038      JsonArray array = json.getAsJsonArray("subDetail");
6039      for (int i = 0; i < array.size(); i++) {
6040        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
6041      }
6042    }
6043    ;
6044  }
6045
6046  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner)
6047      throws IOException, FHIRFormatError {
6048    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
6049    parseClaimSubDetailComponentProperties(json, owner, res);
6050    return res;
6051  }
6052
6053  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res)
6054      throws IOException, FHIRFormatError {
6055    parseBackboneElementProperties(json, res);
6056    if (json.has("sequence"))
6057      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6058    if (json.has("_sequence"))
6059      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6060    if (json.has("revenue"))
6061      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
6062    if (json.has("category"))
6063      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6064    if (json.has("productOrService"))
6065      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6066    if (json.has("modifier")) {
6067      JsonArray array = json.getAsJsonArray("modifier");
6068      for (int i = 0; i < array.size(); i++) {
6069        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6070      }
6071    }
6072    ;
6073    if (json.has("programCode")) {
6074      JsonArray array = json.getAsJsonArray("programCode");
6075      for (int i = 0; i < array.size(); i++) {
6076        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6077      }
6078    }
6079    ;
6080    if (json.has("quantity"))
6081      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6082    if (json.has("unitPrice"))
6083      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6084    if (json.has("factor"))
6085      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6086    if (json.has("_factor"))
6087      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6088    if (json.has("net"))
6089      res.setNet(parseMoney(getJObject(json, "net")));
6090    if (json.has("udi")) {
6091      JsonArray array = json.getAsJsonArray("udi");
6092      for (int i = 0; i < array.size(); i++) {
6093        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6094      }
6095    }
6096    ;
6097  }
6098
6099  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
6100    ClaimResponse res = new ClaimResponse();
6101    parseClaimResponseProperties(json, res);
6102    return res;
6103  }
6104
6105  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
6106    parseDomainResourceProperties(json, res);
6107    if (json.has("identifier")) {
6108      JsonArray array = json.getAsJsonArray("identifier");
6109      for (int i = 0; i < array.size(); i++) {
6110        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6111      }
6112    }
6113    ;
6114    if (json.has("status"))
6115      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL,
6116          new ClaimResponse.ClaimResponseStatusEnumFactory()));
6117    if (json.has("_status"))
6118      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6119    if (json.has("type"))
6120      res.setType(parseCodeableConcept(getJObject(json, "type")));
6121    if (json.has("subType"))
6122      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6123    if (json.has("use"))
6124      res.setUseElement(
6125          parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
6126    if (json.has("_use"))
6127      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
6128    if (json.has("patient"))
6129      res.setPatient(parseReference(getJObject(json, "patient")));
6130    if (json.has("created"))
6131      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6132    if (json.has("_created"))
6133      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
6134    if (json.has("insurer"))
6135      res.setInsurer(parseReference(getJObject(json, "insurer")));
6136    if (json.has("requestor"))
6137      res.setRequestor(parseReference(getJObject(json, "requestor")));
6138    if (json.has("request"))
6139      res.setRequest(parseReference(getJObject(json, "request")));
6140    if (json.has("outcome"))
6141      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL,
6142          new ClaimResponse.RemittanceOutcomeEnumFactory()));
6143    if (json.has("_outcome"))
6144      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
6145    if (json.has("disposition"))
6146      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
6147    if (json.has("_disposition"))
6148      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
6149    if (json.has("preAuthRef"))
6150      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
6151    if (json.has("_preAuthRef"))
6152      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
6153    if (json.has("preAuthPeriod"))
6154      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
6155    if (json.has("payeeType"))
6156      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
6157    if (json.has("item")) {
6158      JsonArray array = json.getAsJsonArray("item");
6159      for (int i = 0; i < array.size(); i++) {
6160        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
6161      }
6162    }
6163    ;
6164    if (json.has("addItem")) {
6165      JsonArray array = json.getAsJsonArray("addItem");
6166      for (int i = 0; i < array.size(); i++) {
6167        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
6168      }
6169    }
6170    ;
6171    if (json.has("adjudication")) {
6172      JsonArray array = json.getAsJsonArray("adjudication");
6173      for (int i = 0; i < array.size(); i++) {
6174        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), res));
6175      }
6176    }
6177    ;
6178    if (json.has("total")) {
6179      JsonArray array = json.getAsJsonArray("total");
6180      for (int i = 0; i < array.size(); i++) {
6181        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
6182      }
6183    }
6184    ;
6185    if (json.has("payment"))
6186      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment"), res));
6187    if (json.has("fundsReserve"))
6188      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
6189    if (json.has("formCode"))
6190      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
6191    if (json.has("form"))
6192      res.setForm(parseAttachment(getJObject(json, "form")));
6193    if (json.has("processNote")) {
6194      JsonArray array = json.getAsJsonArray("processNote");
6195      for (int i = 0; i < array.size(); i++) {
6196        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
6197      }
6198    }
6199    ;
6200    if (json.has("communicationRequest")) {
6201      JsonArray array = json.getAsJsonArray("communicationRequest");
6202      for (int i = 0; i < array.size(); i++) {
6203        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
6204      }
6205    }
6206    ;
6207    if (json.has("insurance")) {
6208      JsonArray array = json.getAsJsonArray("insurance");
6209      for (int i = 0; i < array.size(); i++) {
6210        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
6211      }
6212    }
6213    ;
6214    if (json.has("error")) {
6215      JsonArray array = json.getAsJsonArray("error");
6216      for (int i = 0; i < array.size(); i++) {
6217        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
6218      }
6219    }
6220    ;
6221  }
6222
6223  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner)
6224      throws IOException, FHIRFormatError {
6225    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
6226    parseClaimResponseItemComponentProperties(json, owner, res);
6227    return res;
6228  }
6229
6230  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner,
6231      ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
6232    parseBackboneElementProperties(json, res);
6233    if (json.has("itemSequence"))
6234      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6235    if (json.has("_itemSequence"))
6236      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
6237    if (json.has("noteNumber")) {
6238      JsonArray array = json.getAsJsonArray("noteNumber");
6239      for (int i = 0; i < array.size(); i++) {
6240        if (array.get(i).isJsonNull()) {
6241          res.getNoteNumber().add(new PositiveIntType());
6242        } else {
6243          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6244        }
6245      }
6246    }
6247    ;
6248    if (json.has("_noteNumber")) {
6249      JsonArray array = json.getAsJsonArray("_noteNumber");
6250      for (int i = 0; i < array.size(); i++) {
6251        if (i == res.getNoteNumber().size())
6252          res.getNoteNumber().add(parsePositiveInt(null));
6253        if (array.get(i) instanceof JsonObject)
6254          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6255      }
6256    }
6257    ;
6258    if (json.has("adjudication")) {
6259      JsonArray array = json.getAsJsonArray("adjudication");
6260      for (int i = 0; i < array.size(); i++) {
6261        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6262      }
6263    }
6264    ;
6265    if (json.has("detail")) {
6266      JsonArray array = json.getAsJsonArray("detail");
6267      for (int i = 0; i < array.size(); i++) {
6268        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
6269      }
6270    }
6271    ;
6272  }
6273
6274  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json,
6275      ClaimResponse owner) throws IOException, FHIRFormatError {
6276    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
6277    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
6278    return res;
6279  }
6280
6281  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner,
6282      ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
6283    parseBackboneElementProperties(json, res);
6284    if (json.has("category"))
6285      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6286    if (json.has("reason"))
6287      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
6288    if (json.has("amount"))
6289      res.setAmount(parseMoney(getJObject(json, "amount")));
6290    if (json.has("value"))
6291      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
6292    if (json.has("_value"))
6293      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6294  }
6295
6296  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json,
6297      ClaimResponse owner) throws IOException, FHIRFormatError {
6298    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
6299    parseClaimResponseItemDetailComponentProperties(json, owner, res);
6300    return res;
6301  }
6302
6303  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner,
6304      ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
6305    parseBackboneElementProperties(json, res);
6306    if (json.has("detailSequence"))
6307      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6308    if (json.has("_detailSequence"))
6309      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
6310    if (json.has("noteNumber")) {
6311      JsonArray array = json.getAsJsonArray("noteNumber");
6312      for (int i = 0; i < array.size(); i++) {
6313        if (array.get(i).isJsonNull()) {
6314          res.getNoteNumber().add(new PositiveIntType());
6315        } else {
6316          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6317        }
6318      }
6319    }
6320    ;
6321    if (json.has("_noteNumber")) {
6322      JsonArray array = json.getAsJsonArray("_noteNumber");
6323      for (int i = 0; i < array.size(); i++) {
6324        if (i == res.getNoteNumber().size())
6325          res.getNoteNumber().add(parsePositiveInt(null));
6326        if (array.get(i) instanceof JsonObject)
6327          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6328      }
6329    }
6330    ;
6331    if (json.has("adjudication")) {
6332      JsonArray array = json.getAsJsonArray("adjudication");
6333      for (int i = 0; i < array.size(); i++) {
6334        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6335      }
6336    }
6337    ;
6338    if (json.has("subDetail")) {
6339      JsonArray array = json.getAsJsonArray("subDetail");
6340      for (int i = 0; i < array.size(); i++) {
6341        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
6342      }
6343    }
6344    ;
6345  }
6346
6347  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner)
6348      throws IOException, FHIRFormatError {
6349    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
6350    parseClaimResponseSubDetailComponentProperties(json, owner, res);
6351    return res;
6352  }
6353
6354  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner,
6355      ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
6356    parseBackboneElementProperties(json, res);
6357    if (json.has("subDetailSequence"))
6358      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6359    if (json.has("_subDetailSequence"))
6360      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
6361    if (json.has("noteNumber")) {
6362      JsonArray array = json.getAsJsonArray("noteNumber");
6363      for (int i = 0; i < array.size(); i++) {
6364        if (array.get(i).isJsonNull()) {
6365          res.getNoteNumber().add(new PositiveIntType());
6366        } else {
6367          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6368        }
6369      }
6370    }
6371    ;
6372    if (json.has("_noteNumber")) {
6373      JsonArray array = json.getAsJsonArray("_noteNumber");
6374      for (int i = 0; i < array.size(); i++) {
6375        if (i == res.getNoteNumber().size())
6376          res.getNoteNumber().add(parsePositiveInt(null));
6377        if (array.get(i) instanceof JsonObject)
6378          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6379      }
6380    }
6381    ;
6382    if (json.has("adjudication")) {
6383      JsonArray array = json.getAsJsonArray("adjudication");
6384      for (int i = 0; i < array.size(); i++) {
6385        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6386      }
6387    }
6388    ;
6389  }
6390
6391  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner)
6392      throws IOException, FHIRFormatError {
6393    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
6394    parseClaimResponseAddedItemComponentProperties(json, owner, res);
6395    return res;
6396  }
6397
6398  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner,
6399      ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
6400    parseBackboneElementProperties(json, res);
6401    if (json.has("itemSequence")) {
6402      JsonArray array = json.getAsJsonArray("itemSequence");
6403      for (int i = 0; i < array.size(); i++) {
6404        if (array.get(i).isJsonNull()) {
6405          res.getItemSequence().add(new PositiveIntType());
6406        } else {
6407          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
6408        }
6409      }
6410    }
6411    ;
6412    if (json.has("_itemSequence")) {
6413      JsonArray array = json.getAsJsonArray("_itemSequence");
6414      for (int i = 0; i < array.size(); i++) {
6415        if (i == res.getItemSequence().size())
6416          res.getItemSequence().add(parsePositiveInt(null));
6417        if (array.get(i) instanceof JsonObject)
6418          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
6419      }
6420    }
6421    ;
6422    if (json.has("detailSequence")) {
6423      JsonArray array = json.getAsJsonArray("detailSequence");
6424      for (int i = 0; i < array.size(); i++) {
6425        if (array.get(i).isJsonNull()) {
6426          res.getDetailSequence().add(new PositiveIntType());
6427        } else {
6428          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6429        }
6430      }
6431    }
6432    ;
6433    if (json.has("_detailSequence")) {
6434      JsonArray array = json.getAsJsonArray("_detailSequence");
6435      for (int i = 0; i < array.size(); i++) {
6436        if (i == res.getDetailSequence().size())
6437          res.getDetailSequence().add(parsePositiveInt(null));
6438        if (array.get(i) instanceof JsonObject)
6439          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
6440      }
6441    }
6442    ;
6443    if (json.has("subdetailSequence")) {
6444      JsonArray array = json.getAsJsonArray("subdetailSequence");
6445      for (int i = 0; i < array.size(); i++) {
6446        if (array.get(i).isJsonNull()) {
6447          res.getSubdetailSequence().add(new PositiveIntType());
6448        } else {
6449          res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6450        }
6451      }
6452    }
6453    ;
6454    if (json.has("_subdetailSequence")) {
6455      JsonArray array = json.getAsJsonArray("_subdetailSequence");
6456      for (int i = 0; i < array.size(); i++) {
6457        if (i == res.getSubdetailSequence().size())
6458          res.getSubdetailSequence().add(parsePositiveInt(null));
6459        if (array.get(i) instanceof JsonObject)
6460          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
6461      }
6462    }
6463    ;
6464    if (json.has("provider")) {
6465      JsonArray array = json.getAsJsonArray("provider");
6466      for (int i = 0; i < array.size(); i++) {
6467        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
6468      }
6469    }
6470    ;
6471    if (json.has("productOrService"))
6472      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6473    if (json.has("modifier")) {
6474      JsonArray array = json.getAsJsonArray("modifier");
6475      for (int i = 0; i < array.size(); i++) {
6476        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6477      }
6478    }
6479    ;
6480    if (json.has("programCode")) {
6481      JsonArray array = json.getAsJsonArray("programCode");
6482      for (int i = 0; i < array.size(); i++) {
6483        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6484      }
6485    }
6486    ;
6487    Type serviced = parseType("serviced", json);
6488    if (serviced != null)
6489      res.setServiced(serviced);
6490    Type location = parseType("location", json);
6491    if (location != null)
6492      res.setLocation(location);
6493    if (json.has("quantity"))
6494      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6495    if (json.has("unitPrice"))
6496      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6497    if (json.has("factor"))
6498      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6499    if (json.has("_factor"))
6500      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6501    if (json.has("net"))
6502      res.setNet(parseMoney(getJObject(json, "net")));
6503    if (json.has("bodySite"))
6504      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
6505    if (json.has("subSite")) {
6506      JsonArray array = json.getAsJsonArray("subSite");
6507      for (int i = 0; i < array.size(); i++) {
6508        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6509      }
6510    }
6511    ;
6512    if (json.has("noteNumber")) {
6513      JsonArray array = json.getAsJsonArray("noteNumber");
6514      for (int i = 0; i < array.size(); i++) {
6515        if (array.get(i).isJsonNull()) {
6516          res.getNoteNumber().add(new PositiveIntType());
6517        } else {
6518          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6519        }
6520      }
6521    }
6522    ;
6523    if (json.has("_noteNumber")) {
6524      JsonArray array = json.getAsJsonArray("_noteNumber");
6525      for (int i = 0; i < array.size(); i++) {
6526        if (i == res.getNoteNumber().size())
6527          res.getNoteNumber().add(parsePositiveInt(null));
6528        if (array.get(i) instanceof JsonObject)
6529          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6530      }
6531    }
6532    ;
6533    if (json.has("adjudication")) {
6534      JsonArray array = json.getAsJsonArray("adjudication");
6535      for (int i = 0; i < array.size(); i++) {
6536        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6537      }
6538    }
6539    ;
6540    if (json.has("detail")) {
6541      JsonArray array = json.getAsJsonArray("detail");
6542      for (int i = 0; i < array.size(); i++) {
6543        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
6544      }
6545    }
6546    ;
6547  }
6548
6549  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json,
6550      ClaimResponse owner) throws IOException, FHIRFormatError {
6551    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
6552    parseClaimResponseAddedItemDetailComponentProperties(json, owner, res);
6553    return res;
6554  }
6555
6556  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse owner,
6557      ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
6558    parseBackboneElementProperties(json, res);
6559    if (json.has("productOrService"))
6560      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6561    if (json.has("modifier")) {
6562      JsonArray array = json.getAsJsonArray("modifier");
6563      for (int i = 0; i < array.size(); i++) {
6564        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6565      }
6566    }
6567    ;
6568    if (json.has("quantity"))
6569      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6570    if (json.has("unitPrice"))
6571      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6572    if (json.has("factor"))
6573      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6574    if (json.has("_factor"))
6575      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6576    if (json.has("net"))
6577      res.setNet(parseMoney(getJObject(json, "net")));
6578    if (json.has("noteNumber")) {
6579      JsonArray array = json.getAsJsonArray("noteNumber");
6580      for (int i = 0; i < array.size(); i++) {
6581        if (array.get(i).isJsonNull()) {
6582          res.getNoteNumber().add(new PositiveIntType());
6583        } else {
6584          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6585        }
6586      }
6587    }
6588    ;
6589    if (json.has("_noteNumber")) {
6590      JsonArray array = json.getAsJsonArray("_noteNumber");
6591      for (int i = 0; i < array.size(); i++) {
6592        if (i == res.getNoteNumber().size())
6593          res.getNoteNumber().add(parsePositiveInt(null));
6594        if (array.get(i) instanceof JsonObject)
6595          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6596      }
6597    }
6598    ;
6599    if (json.has("adjudication")) {
6600      JsonArray array = json.getAsJsonArray("adjudication");
6601      for (int i = 0; i < array.size(); i++) {
6602        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6603      }
6604    }
6605    ;
6606    if (json.has("subDetail")) {
6607      JsonArray array = json.getAsJsonArray("subDetail");
6608      for (int i = 0; i < array.size(); i++) {
6609        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject(), owner));
6610      }
6611    }
6612    ;
6613  }
6614
6615  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json,
6616      ClaimResponse owner) throws IOException, FHIRFormatError {
6617    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
6618    parseClaimResponseAddedItemSubDetailComponentProperties(json, owner, res);
6619    return res;
6620  }
6621
6622  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse owner,
6623      ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
6624    parseBackboneElementProperties(json, res);
6625    if (json.has("productOrService"))
6626      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
6627    if (json.has("modifier")) {
6628      JsonArray array = json.getAsJsonArray("modifier");
6629      for (int i = 0; i < array.size(); i++) {
6630        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6631      }
6632    }
6633    ;
6634    if (json.has("quantity"))
6635      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
6636    if (json.has("unitPrice"))
6637      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6638    if (json.has("factor"))
6639      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6640    if (json.has("_factor"))
6641      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6642    if (json.has("net"))
6643      res.setNet(parseMoney(getJObject(json, "net")));
6644    if (json.has("noteNumber")) {
6645      JsonArray array = json.getAsJsonArray("noteNumber");
6646      for (int i = 0; i < array.size(); i++) {
6647        if (array.get(i).isJsonNull()) {
6648          res.getNoteNumber().add(new PositiveIntType());
6649        } else {
6650          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6651        }
6652      }
6653    }
6654    ;
6655    if (json.has("_noteNumber")) {
6656      JsonArray array = json.getAsJsonArray("_noteNumber");
6657      for (int i = 0; i < array.size(); i++) {
6658        if (i == res.getNoteNumber().size())
6659          res.getNoteNumber().add(parsePositiveInt(null));
6660        if (array.get(i) instanceof JsonObject)
6661          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6662      }
6663    }
6664    ;
6665    if (json.has("adjudication")) {
6666      JsonArray array = json.getAsJsonArray("adjudication");
6667      for (int i = 0; i < array.size(); i++) {
6668        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6669      }
6670    }
6671    ;
6672  }
6673
6674  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner)
6675      throws IOException, FHIRFormatError {
6676    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
6677    parseClaimResponseTotalComponentProperties(json, owner, res);
6678    return res;
6679  }
6680
6681  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner,
6682      ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
6683    parseBackboneElementProperties(json, res);
6684    if (json.has("category"))
6685      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6686    if (json.has("amount"))
6687      res.setAmount(parseMoney(getJObject(json, "amount")));
6688  }
6689
6690  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner)
6691      throws IOException, FHIRFormatError {
6692    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
6693    parseClaimResponsePaymentComponentProperties(json, owner, res);
6694    return res;
6695  }
6696
6697  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner,
6698      ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
6699    parseBackboneElementProperties(json, res);
6700    if (json.has("type"))
6701      res.setType(parseCodeableConcept(getJObject(json, "type")));
6702    if (json.has("adjustment"))
6703      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
6704    if (json.has("adjustmentReason"))
6705      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
6706    if (json.has("date"))
6707      res.setDateElement(parseDate(json.get("date").getAsString()));
6708    if (json.has("_date"))
6709      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6710    if (json.has("amount"))
6711      res.setAmount(parseMoney(getJObject(json, "amount")));
6712    if (json.has("identifier"))
6713      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6714  }
6715
6716  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner)
6717      throws IOException, FHIRFormatError {
6718    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
6719    parseClaimResponseNoteComponentProperties(json, owner, res);
6720    return res;
6721  }
6722
6723  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner,
6724      ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
6725    parseBackboneElementProperties(json, res);
6726    if (json.has("number"))
6727      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
6728    if (json.has("_number"))
6729      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
6730    if (json.has("type"))
6731      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL,
6732          new Enumerations.NoteTypeEnumFactory()));
6733    if (json.has("_type"))
6734      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6735    if (json.has("text"))
6736      res.setTextElement(parseString(json.get("text").getAsString()));
6737    if (json.has("_text"))
6738      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6739    if (json.has("language"))
6740      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6741  }
6742
6743  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner)
6744      throws IOException, FHIRFormatError {
6745    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
6746    parseClaimResponseInsuranceComponentProperties(json, owner, res);
6747    return res;
6748  }
6749
6750  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner,
6751      ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
6752    parseBackboneElementProperties(json, res);
6753    if (json.has("sequence"))
6754      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6755    if (json.has("_sequence"))
6756      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6757    if (json.has("focal"))
6758      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6759    if (json.has("_focal"))
6760      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
6761    if (json.has("coverage"))
6762      res.setCoverage(parseReference(getJObject(json, "coverage")));
6763    if (json.has("businessArrangement"))
6764      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6765    if (json.has("_businessArrangement"))
6766      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
6767    if (json.has("claimResponse"))
6768      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
6769  }
6770
6771  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner)
6772      throws IOException, FHIRFormatError {
6773    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
6774    parseClaimResponseErrorComponentProperties(json, owner, res);
6775    return res;
6776  }
6777
6778  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner,
6779      ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
6780    parseBackboneElementProperties(json, res);
6781    if (json.has("itemSequence"))
6782      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6783    if (json.has("_itemSequence"))
6784      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
6785    if (json.has("detailSequence"))
6786      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6787    if (json.has("_detailSequence"))
6788      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
6789    if (json.has("subDetailSequence"))
6790      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6791    if (json.has("_subDetailSequence"))
6792      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
6793    if (json.has("code"))
6794      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6795  }
6796
6797  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
6798    ClinicalImpression res = new ClinicalImpression();
6799    parseClinicalImpressionProperties(json, res);
6800    return res;
6801  }
6802
6803  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res)
6804      throws IOException, FHIRFormatError {
6805    parseDomainResourceProperties(json, res);
6806    if (json.has("identifier")) {
6807      JsonArray array = json.getAsJsonArray("identifier");
6808      for (int i = 0; i < array.size(); i++) {
6809        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6810      }
6811    }
6812    ;
6813    if (json.has("status"))
6814      res.setStatusElement(
6815          parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL,
6816              new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
6817    if (json.has("_status"))
6818      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6819    if (json.has("statusReason"))
6820      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
6821    if (json.has("code"))
6822      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6823    if (json.has("description"))
6824      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6825    if (json.has("_description"))
6826      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6827    if (json.has("subject"))
6828      res.setSubject(parseReference(getJObject(json, "subject")));
6829    if (json.has("encounter"))
6830      res.setEncounter(parseReference(getJObject(json, "encounter")));
6831    Type effective = parseType("effective", json);
6832    if (effective != null)
6833      res.setEffective(effective);
6834    if (json.has("date"))
6835      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6836    if (json.has("_date"))
6837      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6838    if (json.has("assessor"))
6839      res.setAssessor(parseReference(getJObject(json, "assessor")));
6840    if (json.has("previous"))
6841      res.setPrevious(parseReference(getJObject(json, "previous")));
6842    if (json.has("problem")) {
6843      JsonArray array = json.getAsJsonArray("problem");
6844      for (int i = 0; i < array.size(); i++) {
6845        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
6846      }
6847    }
6848    ;
6849    if (json.has("investigation")) {
6850      JsonArray array = json.getAsJsonArray("investigation");
6851      for (int i = 0; i < array.size(); i++) {
6852        res.getInvestigation()
6853            .add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
6854      }
6855    }
6856    ;
6857    if (json.has("protocol")) {
6858      JsonArray array = json.getAsJsonArray("protocol");
6859      for (int i = 0; i < array.size(); i++) {
6860        if (array.get(i).isJsonNull()) {
6861          res.getProtocol().add(new UriType());
6862        } else {
6863          res.getProtocol().add(parseUri(array.get(i).getAsString()));
6864        }
6865      }
6866    }
6867    ;
6868    if (json.has("_protocol")) {
6869      JsonArray array = json.getAsJsonArray("_protocol");
6870      for (int i = 0; i < array.size(); i++) {
6871        if (i == res.getProtocol().size())
6872          res.getProtocol().add(parseUri(null));
6873        if (array.get(i) instanceof JsonObject)
6874          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
6875      }
6876    }
6877    ;
6878    if (json.has("summary"))
6879      res.setSummaryElement(parseString(json.get("summary").getAsString()));
6880    if (json.has("_summary"))
6881      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
6882    if (json.has("finding")) {
6883      JsonArray array = json.getAsJsonArray("finding");
6884      for (int i = 0; i < array.size(); i++) {
6885        res.getFinding()
6886            .add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
6887      }
6888    }
6889    ;
6890    if (json.has("prognosisCodeableConcept")) {
6891      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
6892      for (int i = 0; i < array.size(); i++) {
6893        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6894      }
6895    }
6896    ;
6897    if (json.has("prognosisReference")) {
6898      JsonArray array = json.getAsJsonArray("prognosisReference");
6899      for (int i = 0; i < array.size(); i++) {
6900        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
6901      }
6902    }
6903    ;
6904    if (json.has("supportingInfo")) {
6905      JsonArray array = json.getAsJsonArray("supportingInfo");
6906      for (int i = 0; i < array.size(); i++) {
6907        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
6908      }
6909    }
6910    ;
6911    if (json.has("note")) {
6912      JsonArray array = json.getAsJsonArray("note");
6913      for (int i = 0; i < array.size(); i++) {
6914        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6915      }
6916    }
6917    ;
6918  }
6919
6920  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(
6921      JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6922    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
6923    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
6924    return res;
6925  }
6926
6927  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json,
6928      ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res)
6929      throws IOException, FHIRFormatError {
6930    parseBackboneElementProperties(json, res);
6931    if (json.has("code"))
6932      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6933    if (json.has("item")) {
6934      JsonArray array = json.getAsJsonArray("item");
6935      for (int i = 0; i < array.size(); i++) {
6936        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
6937      }
6938    }
6939    ;
6940  }
6941
6942  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(
6943      JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6944    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
6945    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
6946    return res;
6947  }
6948
6949  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json,
6950      ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res)
6951      throws IOException, FHIRFormatError {
6952    parseBackboneElementProperties(json, res);
6953    if (json.has("itemCodeableConcept"))
6954      res.setItemCodeableConcept(parseCodeableConcept(getJObject(json, "itemCodeableConcept")));
6955    if (json.has("itemReference"))
6956      res.setItemReference(parseReference(getJObject(json, "itemReference")));
6957    if (json.has("basis"))
6958      res.setBasisElement(parseString(json.get("basis").getAsString()));
6959    if (json.has("_basis"))
6960      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
6961  }
6962
6963  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
6964    CodeSystem res = new CodeSystem();
6965    parseCodeSystemProperties(json, res);
6966    return res;
6967  }
6968
6969  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
6970    parseDomainResourceProperties(json, res);
6971    if (json.has("url"))
6972      res.setUrlElement(parseUri(json.get("url").getAsString()));
6973    if (json.has("_url"))
6974      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6975    if (json.has("identifier")) {
6976      JsonArray array = json.getAsJsonArray("identifier");
6977      for (int i = 0; i < array.size(); i++) {
6978        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6979      }
6980    }
6981    ;
6982    if (json.has("version"))
6983      res.setVersionElement(parseString(json.get("version").getAsString()));
6984    if (json.has("_version"))
6985      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
6986    if (json.has("name"))
6987      res.setNameElement(parseString(json.get("name").getAsString()));
6988    if (json.has("_name"))
6989      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
6990    if (json.has("title"))
6991      res.setTitleElement(parseString(json.get("title").getAsString()));
6992    if (json.has("_title"))
6993      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6994    if (json.has("status"))
6995      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
6996          new Enumerations.PublicationStatusEnumFactory()));
6997    if (json.has("_status"))
6998      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6999    if (json.has("experimental"))
7000      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7001    if (json.has("_experimental"))
7002      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7003    if (json.has("date"))
7004      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7005    if (json.has("_date"))
7006      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7007    if (json.has("publisher"))
7008      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7009    if (json.has("_publisher"))
7010      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7011    if (json.has("contact")) {
7012      JsonArray array = json.getAsJsonArray("contact");
7013      for (int i = 0; i < array.size(); i++) {
7014        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7015      }
7016    }
7017    ;
7018    if (json.has("description"))
7019      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7020    if (json.has("_description"))
7021      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7022    if (json.has("useContext")) {
7023      JsonArray array = json.getAsJsonArray("useContext");
7024      for (int i = 0; i < array.size(); i++) {
7025        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7026      }
7027    }
7028    ;
7029    if (json.has("jurisdiction")) {
7030      JsonArray array = json.getAsJsonArray("jurisdiction");
7031      for (int i = 0; i < array.size(); i++) {
7032        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7033      }
7034    }
7035    ;
7036    if (json.has("purpose"))
7037      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7038    if (json.has("_purpose"))
7039      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
7040    if (json.has("copyright"))
7041      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7042    if (json.has("_copyright"))
7043      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7044    if (json.has("caseSensitive"))
7045      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
7046    if (json.has("_caseSensitive"))
7047      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
7048    if (json.has("valueSet"))
7049      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
7050    if (json.has("_valueSet"))
7051      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
7052    if (json.has("hierarchyMeaning"))
7053      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(),
7054          CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
7055    if (json.has("_hierarchyMeaning"))
7056      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
7057    if (json.has("compositional"))
7058      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
7059    if (json.has("_compositional"))
7060      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
7061    if (json.has("versionNeeded"))
7062      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
7063    if (json.has("_versionNeeded"))
7064      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
7065    if (json.has("content"))
7066      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL,
7067          new CodeSystem.CodeSystemContentModeEnumFactory()));
7068    if (json.has("_content"))
7069      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
7070    if (json.has("supplements"))
7071      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
7072    if (json.has("_supplements"))
7073      parseElementProperties(getJObject(json, "_supplements"), res.getSupplementsElement());
7074    if (json.has("count"))
7075      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
7076    if (json.has("_count"))
7077      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
7078    if (json.has("filter")) {
7079      JsonArray array = json.getAsJsonArray("filter");
7080      for (int i = 0; i < array.size(); i++) {
7081        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
7082      }
7083    }
7084    ;
7085    if (json.has("property")) {
7086      JsonArray array = json.getAsJsonArray("property");
7087      for (int i = 0; i < array.size(); i++) {
7088        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
7089      }
7090    }
7091    ;
7092    if (json.has("concept")) {
7093      JsonArray array = json.getAsJsonArray("concept");
7094      for (int i = 0; i < array.size(); i++) {
7095        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
7096      }
7097    }
7098    ;
7099  }
7100
7101  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json,
7102      CodeSystem owner) throws IOException, FHIRFormatError {
7103    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
7104    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
7105    return res;
7106  }
7107
7108  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner,
7109      CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
7110    parseBackboneElementProperties(json, res);
7111    if (json.has("code"))
7112      res.setCodeElement(parseCode(json.get("code").getAsString()));
7113    if (json.has("_code"))
7114      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7115    if (json.has("description"))
7116      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7117    if (json.has("_description"))
7118      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7119    if (json.has("operator")) {
7120      JsonArray array = json.getAsJsonArray("operator");
7121      for (int i = 0; i < array.size(); i++) {
7122        if (array.get(i).isJsonNull()) {
7123          res.getOperator().add(new Enumeration<CodeSystem.FilterOperator>());
7124        } else {
7125          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL,
7126              new CodeSystem.FilterOperatorEnumFactory()));
7127        }
7128      }
7129    }
7130    ;
7131    if (json.has("_operator")) {
7132      JsonArray array = json.getAsJsonArray("_operator");
7133      for (int i = 0; i < array.size(); i++) {
7134        if (i == res.getOperator().size())
7135          res.getOperator()
7136              .add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
7137        if (array.get(i) instanceof JsonObject)
7138          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
7139      }
7140    }
7141    ;
7142    if (json.has("value"))
7143      res.setValueElement(parseString(json.get("value").getAsString()));
7144    if (json.has("_value"))
7145      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7146  }
7147
7148  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner)
7149      throws IOException, FHIRFormatError {
7150    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
7151    parseCodeSystemPropertyComponentProperties(json, owner, res);
7152    return res;
7153  }
7154
7155  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner,
7156      CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
7157    parseBackboneElementProperties(json, res);
7158    if (json.has("code"))
7159      res.setCodeElement(parseCode(json.get("code").getAsString()));
7160    if (json.has("_code"))
7161      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7162    if (json.has("uri"))
7163      res.setUriElement(parseUri(json.get("uri").getAsString()));
7164    if (json.has("_uri"))
7165      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
7166    if (json.has("description"))
7167      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7168    if (json.has("_description"))
7169      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7170    if (json.has("type"))
7171      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL,
7172          new CodeSystem.PropertyTypeEnumFactory()));
7173    if (json.has("_type"))
7174      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7175  }
7176
7177  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json,
7178      CodeSystem owner) throws IOException, FHIRFormatError {
7179    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
7180    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
7181    return res;
7182  }
7183
7184  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner,
7185      CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
7186    parseBackboneElementProperties(json, res);
7187    if (json.has("code"))
7188      res.setCodeElement(parseCode(json.get("code").getAsString()));
7189    if (json.has("_code"))
7190      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7191    if (json.has("display"))
7192      res.setDisplayElement(parseString(json.get("display").getAsString()));
7193    if (json.has("_display"))
7194      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7195    if (json.has("definition"))
7196      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
7197    if (json.has("_definition"))
7198      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
7199    if (json.has("designation")) {
7200      JsonArray array = json.getAsJsonArray("designation");
7201      for (int i = 0; i < array.size(); i++) {
7202        res.getDesignation()
7203            .add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
7204      }
7205    }
7206    ;
7207    if (json.has("property")) {
7208      JsonArray array = json.getAsJsonArray("property");
7209      for (int i = 0; i < array.size(); i++) {
7210        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
7211      }
7212    }
7213    ;
7214    if (json.has("concept")) {
7215      JsonArray array = json.getAsJsonArray("concept");
7216      for (int i = 0; i < array.size(); i++) {
7217        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
7218      }
7219    }
7220    ;
7221  }
7222
7223  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(
7224      JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
7225    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
7226    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
7227    return res;
7228  }
7229
7230  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner,
7231      CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
7232    parseBackboneElementProperties(json, res);
7233    if (json.has("language"))
7234      res.setLanguageElement(parseCode(json.get("language").getAsString()));
7235    if (json.has("_language"))
7236      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
7237    if (json.has("use"))
7238      res.setUse(parseCoding(getJObject(json, "use")));
7239    if (json.has("value"))
7240      res.setValueElement(parseString(json.get("value").getAsString()));
7241    if (json.has("_value"))
7242      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7243  }
7244
7245  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json,
7246      CodeSystem owner) throws IOException, FHIRFormatError {
7247    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
7248    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
7249    return res;
7250  }
7251
7252  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner,
7253      CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
7254    parseBackboneElementProperties(json, res);
7255    if (json.has("code"))
7256      res.setCodeElement(parseCode(json.get("code").getAsString()));
7257    if (json.has("_code"))
7258      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7259    Type value = parseType("value", json);
7260    if (value != null)
7261      res.setValue(value);
7262  }
7263
7264  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
7265    Communication res = new Communication();
7266    parseCommunicationProperties(json, res);
7267    return res;
7268  }
7269
7270  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
7271    parseDomainResourceProperties(json, res);
7272    if (json.has("identifier")) {
7273      JsonArray array = json.getAsJsonArray("identifier");
7274      for (int i = 0; i < array.size(); i++) {
7275        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7276      }
7277    }
7278    ;
7279    if (json.has("instantiatesCanonical")) {
7280      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
7281      for (int i = 0; i < array.size(); i++) {
7282        if (array.get(i).isJsonNull()) {
7283          res.getInstantiatesCanonical().add(new CanonicalType());
7284        } else {
7285          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
7286        }
7287      }
7288    }
7289    ;
7290    if (json.has("_instantiatesCanonical")) {
7291      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
7292      for (int i = 0; i < array.size(); i++) {
7293        if (i == res.getInstantiatesCanonical().size())
7294          res.getInstantiatesCanonical().add(parseCanonical(null));
7295        if (array.get(i) instanceof JsonObject)
7296          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
7297      }
7298    }
7299    ;
7300    if (json.has("instantiatesUri")) {
7301      JsonArray array = json.getAsJsonArray("instantiatesUri");
7302      for (int i = 0; i < array.size(); i++) {
7303        if (array.get(i).isJsonNull()) {
7304          res.getInstantiatesUri().add(new UriType());
7305        } else {
7306          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
7307        }
7308      }
7309    }
7310    ;
7311    if (json.has("_instantiatesUri")) {
7312      JsonArray array = json.getAsJsonArray("_instantiatesUri");
7313      for (int i = 0; i < array.size(); i++) {
7314        if (i == res.getInstantiatesUri().size())
7315          res.getInstantiatesUri().add(parseUri(null));
7316        if (array.get(i) instanceof JsonObject)
7317          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
7318      }
7319    }
7320    ;
7321    if (json.has("basedOn")) {
7322      JsonArray array = json.getAsJsonArray("basedOn");
7323      for (int i = 0; i < array.size(); i++) {
7324        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7325      }
7326    }
7327    ;
7328    if (json.has("partOf")) {
7329      JsonArray array = json.getAsJsonArray("partOf");
7330      for (int i = 0; i < array.size(); i++) {
7331        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
7332      }
7333    }
7334    ;
7335    if (json.has("inResponseTo")) {
7336      JsonArray array = json.getAsJsonArray("inResponseTo");
7337      for (int i = 0; i < array.size(); i++) {
7338        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
7339      }
7340    }
7341    ;
7342    if (json.has("status"))
7343      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL,
7344          new Communication.CommunicationStatusEnumFactory()));
7345    if (json.has("_status"))
7346      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7347    if (json.has("statusReason"))
7348      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
7349    if (json.has("category")) {
7350      JsonArray array = json.getAsJsonArray("category");
7351      for (int i = 0; i < array.size(); i++) {
7352        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7353      }
7354    }
7355    ;
7356    if (json.has("priority"))
7357      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(),
7358          Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
7359    if (json.has("_priority"))
7360      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
7361    if (json.has("medium")) {
7362      JsonArray array = json.getAsJsonArray("medium");
7363      for (int i = 0; i < array.size(); i++) {
7364        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7365      }
7366    }
7367    ;
7368    if (json.has("subject"))
7369      res.setSubject(parseReference(getJObject(json, "subject")));
7370    if (json.has("topic"))
7371      res.setTopic(parseCodeableConcept(getJObject(json, "topic")));
7372    if (json.has("about")) {
7373      JsonArray array = json.getAsJsonArray("about");
7374      for (int i = 0; i < array.size(); i++) {
7375        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7376      }
7377    }
7378    ;
7379    if (json.has("encounter"))
7380      res.setEncounter(parseReference(getJObject(json, "encounter")));
7381    if (json.has("sent"))
7382      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
7383    if (json.has("_sent"))
7384      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
7385    if (json.has("received"))
7386      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
7387    if (json.has("_received"))
7388      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
7389    if (json.has("recipient")) {
7390      JsonArray array = json.getAsJsonArray("recipient");
7391      for (int i = 0; i < array.size(); i++) {
7392        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7393      }
7394    }
7395    ;
7396    if (json.has("sender"))
7397      res.setSender(parseReference(getJObject(json, "sender")));
7398    if (json.has("reasonCode")) {
7399      JsonArray array = json.getAsJsonArray("reasonCode");
7400      for (int i = 0; i < array.size(); i++) {
7401        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7402      }
7403    }
7404    ;
7405    if (json.has("reasonReference")) {
7406      JsonArray array = json.getAsJsonArray("reasonReference");
7407      for (int i = 0; i < array.size(); i++) {
7408        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7409      }
7410    }
7411    ;
7412    if (json.has("payload")) {
7413      JsonArray array = json.getAsJsonArray("payload");
7414      for (int i = 0; i < array.size(); i++) {
7415        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
7416      }
7417    }
7418    ;
7419    if (json.has("note")) {
7420      JsonArray array = json.getAsJsonArray("note");
7421      for (int i = 0; i < array.size(); i++) {
7422        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7423      }
7424    }
7425    ;
7426  }
7427
7428  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json,
7429      Communication owner) throws IOException, FHIRFormatError {
7430    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
7431    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
7432    return res;
7433  }
7434
7435  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner,
7436      Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
7437    parseBackboneElementProperties(json, res);
7438    Type content = parseType("content", json);
7439    if (content != null)
7440      res.setContent(content);
7441  }
7442
7443  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
7444    CommunicationRequest res = new CommunicationRequest();
7445    parseCommunicationRequestProperties(json, res);
7446    return res;
7447  }
7448
7449  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res)
7450      throws IOException, FHIRFormatError {
7451    parseDomainResourceProperties(json, res);
7452    if (json.has("identifier")) {
7453      JsonArray array = json.getAsJsonArray("identifier");
7454      for (int i = 0; i < array.size(); i++) {
7455        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7456      }
7457    }
7458    ;
7459    if (json.has("basedOn")) {
7460      JsonArray array = json.getAsJsonArray("basedOn");
7461      for (int i = 0; i < array.size(); i++) {
7462        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7463      }
7464    }
7465    ;
7466    if (json.has("replaces")) {
7467      JsonArray array = json.getAsJsonArray("replaces");
7468      for (int i = 0; i < array.size(); i++) {
7469        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
7470      }
7471    }
7472    ;
7473    if (json.has("groupIdentifier"))
7474      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
7475    if (json.has("status"))
7476      res.setStatusElement(
7477          parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL,
7478              new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
7479    if (json.has("_status"))
7480      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7481    if (json.has("statusReason"))
7482      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
7483    if (json.has("category")) {
7484      JsonArray array = json.getAsJsonArray("category");
7485      for (int i = 0; i < array.size(); i++) {
7486        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7487      }
7488    }
7489    ;
7490    if (json.has("priority"))
7491      res.setPriorityElement(
7492          parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL,
7493              new CommunicationRequest.CommunicationPriorityEnumFactory()));
7494    if (json.has("_priority"))
7495      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
7496    if (json.has("doNotPerform"))
7497      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
7498    if (json.has("_doNotPerform"))
7499      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
7500    if (json.has("medium")) {
7501      JsonArray array = json.getAsJsonArray("medium");
7502      for (int i = 0; i < array.size(); i++) {
7503        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7504      }
7505    }
7506    ;
7507    if (json.has("subject"))
7508      res.setSubject(parseReference(getJObject(json, "subject")));
7509    if (json.has("about")) {
7510      JsonArray array = json.getAsJsonArray("about");
7511      for (int i = 0; i < array.size(); i++) {
7512        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7513      }
7514    }
7515    ;
7516    if (json.has("encounter"))
7517      res.setEncounter(parseReference(getJObject(json, "encounter")));
7518    if (json.has("payload")) {
7519      JsonArray array = json.getAsJsonArray("payload");
7520      for (int i = 0; i < array.size(); i++) {
7521        res.getPayload()
7522            .add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
7523      }
7524    }
7525    ;
7526    Type occurrence = parseType("occurrence", json);
7527    if (occurrence != null)
7528      res.setOccurrence(occurrence);
7529    if (json.has("authoredOn"))
7530      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7531    if (json.has("_authoredOn"))
7532      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
7533    if (json.has("requester"))
7534      res.setRequester(parseReference(getJObject(json, "requester")));
7535    if (json.has("recipient")) {
7536      JsonArray array = json.getAsJsonArray("recipient");
7537      for (int i = 0; i < array.size(); i++) {
7538        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7539      }
7540    }
7541    ;
7542    if (json.has("sender"))
7543      res.setSender(parseReference(getJObject(json, "sender")));
7544    if (json.has("reasonCode")) {
7545      JsonArray array = json.getAsJsonArray("reasonCode");
7546      for (int i = 0; i < array.size(); i++) {
7547        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7548      }
7549    }
7550    ;
7551    if (json.has("reasonReference")) {
7552      JsonArray array = json.getAsJsonArray("reasonReference");
7553      for (int i = 0; i < array.size(); i++) {
7554        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7555      }
7556    }
7557    ;
7558    if (json.has("note")) {
7559      JsonArray array = json.getAsJsonArray("note");
7560      for (int i = 0; i < array.size(); i++) {
7561        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7562      }
7563    }
7564    ;
7565  }
7566
7567  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(
7568      JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
7569    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
7570    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
7571    return res;
7572  }
7573
7574  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json,
7575      CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res)
7576      throws IOException, FHIRFormatError {
7577    parseBackboneElementProperties(json, res);
7578    Type content = parseType("content", json);
7579    if (content != null)
7580      res.setContent(content);
7581  }
7582
7583  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
7584    CompartmentDefinition res = new CompartmentDefinition();
7585    parseCompartmentDefinitionProperties(json, res);
7586    return res;
7587  }
7588
7589  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res)
7590      throws IOException, FHIRFormatError {
7591    parseDomainResourceProperties(json, res);
7592    if (json.has("url"))
7593      res.setUrlElement(parseUri(json.get("url").getAsString()));
7594    if (json.has("_url"))
7595      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7596    if (json.has("version"))
7597      res.setVersionElement(parseString(json.get("version").getAsString()));
7598    if (json.has("_version"))
7599      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7600    if (json.has("name"))
7601      res.setNameElement(parseString(json.get("name").getAsString()));
7602    if (json.has("_name"))
7603      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7604    if (json.has("status"))
7605      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
7606          new Enumerations.PublicationStatusEnumFactory()));
7607    if (json.has("_status"))
7608      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7609    if (json.has("experimental"))
7610      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7611    if (json.has("_experimental"))
7612      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7613    if (json.has("date"))
7614      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7615    if (json.has("_date"))
7616      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7617    if (json.has("publisher"))
7618      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7619    if (json.has("_publisher"))
7620      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7621    if (json.has("contact")) {
7622      JsonArray array = json.getAsJsonArray("contact");
7623      for (int i = 0; i < array.size(); i++) {
7624        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7625      }
7626    }
7627    ;
7628    if (json.has("description"))
7629      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7630    if (json.has("_description"))
7631      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7632    if (json.has("useContext")) {
7633      JsonArray array = json.getAsJsonArray("useContext");
7634      for (int i = 0; i < array.size(); i++) {
7635        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7636      }
7637    }
7638    ;
7639    if (json.has("purpose"))
7640      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7641    if (json.has("_purpose"))
7642      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
7643    if (json.has("code"))
7644      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL,
7645          new CompartmentDefinition.CompartmentTypeEnumFactory()));
7646    if (json.has("_code"))
7647      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7648    if (json.has("search"))
7649      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
7650    if (json.has("_search"))
7651      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
7652    if (json.has("resource")) {
7653      JsonArray array = json.getAsJsonArray("resource");
7654      for (int i = 0; i < array.size(); i++) {
7655        res.getResource()
7656            .add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
7657      }
7658    }
7659    ;
7660  }
7661
7662  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(
7663      JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
7664    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
7665    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
7666    return res;
7667  }
7668
7669  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json,
7670      CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res)
7671      throws IOException, FHIRFormatError {
7672    parseBackboneElementProperties(json, res);
7673    if (json.has("code"))
7674      res.setCodeElement(parseCode(json.get("code").getAsString()));
7675    if (json.has("_code"))
7676      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7677    if (json.has("param")) {
7678      JsonArray array = json.getAsJsonArray("param");
7679      for (int i = 0; i < array.size(); i++) {
7680        if (array.get(i).isJsonNull()) {
7681          res.getParam().add(new StringType());
7682        } else {
7683          res.getParam().add(parseString(array.get(i).getAsString()));
7684        }
7685      }
7686    }
7687    ;
7688    if (json.has("_param")) {
7689      JsonArray array = json.getAsJsonArray("_param");
7690      for (int i = 0; i < array.size(); i++) {
7691        if (i == res.getParam().size())
7692          res.getParam().add(parseString(null));
7693        if (array.get(i) instanceof JsonObject)
7694          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
7695      }
7696    }
7697    ;
7698    if (json.has("documentation"))
7699      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
7700    if (json.has("_documentation"))
7701      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
7702  }
7703
7704  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
7705    Composition res = new Composition();
7706    parseCompositionProperties(json, res);
7707    return res;
7708  }
7709
7710  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
7711    parseDomainResourceProperties(json, res);
7712    if (json.has("identifier"))
7713      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7714    if (json.has("status"))
7715      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL,
7716          new Composition.CompositionStatusEnumFactory()));
7717    if (json.has("_status"))
7718      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7719    if (json.has("type"))
7720      res.setType(parseCodeableConcept(getJObject(json, "type")));
7721    if (json.has("category")) {
7722      JsonArray array = json.getAsJsonArray("category");
7723      for (int i = 0; i < array.size(); i++) {
7724        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7725      }
7726    }
7727    ;
7728    if (json.has("subject"))
7729      res.setSubject(parseReference(getJObject(json, "subject")));
7730    if (json.has("encounter"))
7731      res.setEncounter(parseReference(getJObject(json, "encounter")));
7732    if (json.has("date"))
7733      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7734    if (json.has("_date"))
7735      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7736    if (json.has("author")) {
7737      JsonArray array = json.getAsJsonArray("author");
7738      for (int i = 0; i < array.size(); i++) {
7739        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7740      }
7741    }
7742    ;
7743    if (json.has("title"))
7744      res.setTitleElement(parseString(json.get("title").getAsString()));
7745    if (json.has("_title"))
7746      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7747    if (json.has("confidentiality"))
7748      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(),
7749          Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
7750    if (json.has("_confidentiality"))
7751      parseElementProperties(getJObject(json, "_confidentiality"), res.getConfidentialityElement());
7752    if (json.has("attester")) {
7753      JsonArray array = json.getAsJsonArray("attester");
7754      for (int i = 0; i < array.size(); i++) {
7755        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
7756      }
7757    }
7758    ;
7759    if (json.has("custodian"))
7760      res.setCustodian(parseReference(getJObject(json, "custodian")));
7761    if (json.has("relatesTo")) {
7762      JsonArray array = json.getAsJsonArray("relatesTo");
7763      for (int i = 0; i < array.size(); i++) {
7764        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
7765      }
7766    }
7767    ;
7768    if (json.has("event")) {
7769      JsonArray array = json.getAsJsonArray("event");
7770      for (int i = 0; i < array.size(); i++) {
7771        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
7772      }
7773    }
7774    ;
7775    if (json.has("section")) {
7776      JsonArray array = json.getAsJsonArray("section");
7777      for (int i = 0; i < array.size(); i++) {
7778        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
7779      }
7780    }
7781    ;
7782  }
7783
7784  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json,
7785      Composition owner) throws IOException, FHIRFormatError {
7786    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
7787    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
7788    return res;
7789  }
7790
7791  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner,
7792      Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
7793    parseBackboneElementProperties(json, res);
7794    if (json.has("mode"))
7795      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL,
7796          new Composition.CompositionAttestationModeEnumFactory()));
7797    if (json.has("_mode"))
7798      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
7799    if (json.has("time"))
7800      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
7801    if (json.has("_time"))
7802      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
7803    if (json.has("party"))
7804      res.setParty(parseReference(getJObject(json, "party")));
7805  }
7806
7807  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json,
7808      Composition owner) throws IOException, FHIRFormatError {
7809    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
7810    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
7811    return res;
7812  }
7813
7814  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner,
7815      Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
7816    parseBackboneElementProperties(json, res);
7817    if (json.has("code"))
7818      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL,
7819          new Composition.DocumentRelationshipTypeEnumFactory()));
7820    if (json.has("_code"))
7821      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7822    Type target = parseType("target", json);
7823    if (target != null)
7824      res.setTarget(target);
7825  }
7826
7827  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json,
7828      Composition owner) throws IOException, FHIRFormatError {
7829    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
7830    parseCompositionCompositionEventComponentProperties(json, owner, res);
7831    return res;
7832  }
7833
7834  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner,
7835      Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
7836    parseBackboneElementProperties(json, res);
7837    if (json.has("code")) {
7838      JsonArray array = json.getAsJsonArray("code");
7839      for (int i = 0; i < array.size(); i++) {
7840        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7841      }
7842    }
7843    ;
7844    if (json.has("period"))
7845      res.setPeriod(parsePeriod(getJObject(json, "period")));
7846    if (json.has("detail")) {
7847      JsonArray array = json.getAsJsonArray("detail");
7848      for (int i = 0; i < array.size(); i++) {
7849        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7850      }
7851    }
7852    ;
7853  }
7854
7855  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner)
7856      throws IOException, FHIRFormatError {
7857    Composition.SectionComponent res = new Composition.SectionComponent();
7858    parseCompositionSectionComponentProperties(json, owner, res);
7859    return res;
7860  }
7861
7862  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner,
7863      Composition.SectionComponent res) throws IOException, FHIRFormatError {
7864    parseBackboneElementProperties(json, res);
7865    if (json.has("title"))
7866      res.setTitleElement(parseString(json.get("title").getAsString()));
7867    if (json.has("_title"))
7868      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7869    if (json.has("code"))
7870      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7871    if (json.has("author")) {
7872      JsonArray array = json.getAsJsonArray("author");
7873      for (int i = 0; i < array.size(); i++) {
7874        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7875      }
7876    }
7877    ;
7878    if (json.has("focus"))
7879      res.setFocus(parseReference(getJObject(json, "focus")));
7880    if (json.has("text"))
7881      res.setText(parseNarrative(getJObject(json, "text")));
7882    if (json.has("mode"))
7883      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL,
7884          new Composition.SectionModeEnumFactory()));
7885    if (json.has("_mode"))
7886      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
7887    if (json.has("orderedBy"))
7888      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
7889    if (json.has("entry")) {
7890      JsonArray array = json.getAsJsonArray("entry");
7891      for (int i = 0; i < array.size(); i++) {
7892        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
7893      }
7894    }
7895    ;
7896    if (json.has("emptyReason"))
7897      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
7898    if (json.has("section")) {
7899      JsonArray array = json.getAsJsonArray("section");
7900      for (int i = 0; i < array.size(); i++) {
7901        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
7902      }
7903    }
7904    ;
7905  }
7906
7907  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
7908    ConceptMap res = new ConceptMap();
7909    parseConceptMapProperties(json, res);
7910    return res;
7911  }
7912
7913  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
7914    parseDomainResourceProperties(json, res);
7915    if (json.has("url"))
7916      res.setUrlElement(parseUri(json.get("url").getAsString()));
7917    if (json.has("_url"))
7918      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7919    if (json.has("identifier"))
7920      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7921    if (json.has("version"))
7922      res.setVersionElement(parseString(json.get("version").getAsString()));
7923    if (json.has("_version"))
7924      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7925    if (json.has("name"))
7926      res.setNameElement(parseString(json.get("name").getAsString()));
7927    if (json.has("_name"))
7928      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7929    if (json.has("title"))
7930      res.setTitleElement(parseString(json.get("title").getAsString()));
7931    if (json.has("_title"))
7932      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7933    if (json.has("status"))
7934      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
7935          new Enumerations.PublicationStatusEnumFactory()));
7936    if (json.has("_status"))
7937      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7938    if (json.has("experimental"))
7939      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7940    if (json.has("_experimental"))
7941      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7942    if (json.has("date"))
7943      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7944    if (json.has("_date"))
7945      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7946    if (json.has("publisher"))
7947      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7948    if (json.has("_publisher"))
7949      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7950    if (json.has("contact")) {
7951      JsonArray array = json.getAsJsonArray("contact");
7952      for (int i = 0; i < array.size(); i++) {
7953        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7954      }
7955    }
7956    ;
7957    if (json.has("description"))
7958      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7959    if (json.has("_description"))
7960      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7961    if (json.has("useContext")) {
7962      JsonArray array = json.getAsJsonArray("useContext");
7963      for (int i = 0; i < array.size(); i++) {
7964        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7965      }
7966    }
7967    ;
7968    if (json.has("jurisdiction")) {
7969      JsonArray array = json.getAsJsonArray("jurisdiction");
7970      for (int i = 0; i < array.size(); i++) {
7971        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7972      }
7973    }
7974    ;
7975    if (json.has("purpose"))
7976      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7977    if (json.has("_purpose"))
7978      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
7979    if (json.has("copyright"))
7980      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7981    if (json.has("_copyright"))
7982      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7983    Type source = parseType("source", json);
7984    if (source != null)
7985      res.setSource(source);
7986    Type target = parseType("target", json);
7987    if (target != null)
7988      res.setTarget(target);
7989    if (json.has("group")) {
7990      JsonArray array = json.getAsJsonArray("group");
7991      for (int i = 0; i < array.size(); i++) {
7992        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
7993      }
7994    }
7995    ;
7996  }
7997
7998  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json,
7999      ConceptMap owner) throws IOException, FHIRFormatError {
8000    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
8001    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
8002    return res;
8003  }
8004
8005  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner,
8006      ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
8007    parseBackboneElementProperties(json, res);
8008    if (json.has("source"))
8009      res.setSourceElement(parseUri(json.get("source").getAsString()));
8010    if (json.has("_source"))
8011      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
8012    if (json.has("sourceVersion"))
8013      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
8014    if (json.has("_sourceVersion"))
8015      parseElementProperties(getJObject(json, "_sourceVersion"), res.getSourceVersionElement());
8016    if (json.has("target"))
8017      res.setTargetElement(parseUri(json.get("target").getAsString()));
8018    if (json.has("_target"))
8019      parseElementProperties(getJObject(json, "_target"), res.getTargetElement());
8020    if (json.has("targetVersion"))
8021      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
8022    if (json.has("_targetVersion"))
8023      parseElementProperties(getJObject(json, "_targetVersion"), res.getTargetVersionElement());
8024    if (json.has("element")) {
8025      JsonArray array = json.getAsJsonArray("element");
8026      for (int i = 0; i < array.size(); i++) {
8027        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
8028      }
8029    }
8030    ;
8031    if (json.has("unmapped"))
8032      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(getJObject(json, "unmapped"), owner));
8033  }
8034
8035  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner)
8036      throws IOException, FHIRFormatError {
8037    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
8038    parseConceptMapSourceElementComponentProperties(json, owner, res);
8039    return res;
8040  }
8041
8042  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner,
8043      ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
8044    parseBackboneElementProperties(json, res);
8045    if (json.has("code"))
8046      res.setCodeElement(parseCode(json.get("code").getAsString()));
8047    if (json.has("_code"))
8048      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8049    if (json.has("display"))
8050      res.setDisplayElement(parseString(json.get("display").getAsString()));
8051    if (json.has("_display"))
8052      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8053    if (json.has("target")) {
8054      JsonArray array = json.getAsJsonArray("target");
8055      for (int i = 0; i < array.size(); i++) {
8056        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
8057      }
8058    }
8059    ;
8060  }
8061
8062  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner)
8063      throws IOException, FHIRFormatError {
8064    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
8065    parseConceptMapTargetElementComponentProperties(json, owner, res);
8066    return res;
8067  }
8068
8069  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner,
8070      ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
8071    parseBackboneElementProperties(json, res);
8072    if (json.has("code"))
8073      res.setCodeElement(parseCode(json.get("code").getAsString()));
8074    if (json.has("_code"))
8075      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8076    if (json.has("display"))
8077      res.setDisplayElement(parseString(json.get("display").getAsString()));
8078    if (json.has("_display"))
8079      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8080    if (json.has("equivalence"))
8081      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(),
8082          Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
8083    if (json.has("_equivalence"))
8084      parseElementProperties(getJObject(json, "_equivalence"), res.getEquivalenceElement());
8085    if (json.has("comment"))
8086      res.setCommentElement(parseString(json.get("comment").getAsString()));
8087    if (json.has("_comment"))
8088      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
8089    if (json.has("dependsOn")) {
8090      JsonArray array = json.getAsJsonArray("dependsOn");
8091      for (int i = 0; i < array.size(); i++) {
8092        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
8093      }
8094    }
8095    ;
8096    if (json.has("product")) {
8097      JsonArray array = json.getAsJsonArray("product");
8098      for (int i = 0; i < array.size(); i++) {
8099        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
8100      }
8101    }
8102    ;
8103  }
8104
8105  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner)
8106      throws IOException, FHIRFormatError {
8107    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
8108    parseConceptMapOtherElementComponentProperties(json, owner, res);
8109    return res;
8110  }
8111
8112  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner,
8113      ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
8114    parseBackboneElementProperties(json, res);
8115    if (json.has("property"))
8116      res.setPropertyElement(parseUri(json.get("property").getAsString()));
8117    if (json.has("_property"))
8118      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
8119    if (json.has("system"))
8120      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
8121    if (json.has("_system"))
8122      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
8123    if (json.has("value"))
8124      res.setValueElement(parseString(json.get("value").getAsString()));
8125    if (json.has("_value"))
8126      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8127    if (json.has("display"))
8128      res.setDisplayElement(parseString(json.get("display").getAsString()));
8129    if (json.has("_display"))
8130      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8131  }
8132
8133  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json,
8134      ConceptMap owner) throws IOException, FHIRFormatError {
8135    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
8136    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
8137    return res;
8138  }
8139
8140  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner,
8141      ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
8142    parseBackboneElementProperties(json, res);
8143    if (json.has("mode"))
8144      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL,
8145          new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
8146    if (json.has("_mode"))
8147      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
8148    if (json.has("code"))
8149      res.setCodeElement(parseCode(json.get("code").getAsString()));
8150    if (json.has("_code"))
8151      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
8152    if (json.has("display"))
8153      res.setDisplayElement(parseString(json.get("display").getAsString()));
8154    if (json.has("_display"))
8155      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
8156    if (json.has("url"))
8157      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
8158    if (json.has("_url"))
8159      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8160  }
8161
8162  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
8163    Condition res = new Condition();
8164    parseConditionProperties(json, res);
8165    return res;
8166  }
8167
8168  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
8169    parseDomainResourceProperties(json, res);
8170    if (json.has("identifier")) {
8171      JsonArray array = json.getAsJsonArray("identifier");
8172      for (int i = 0; i < array.size(); i++) {
8173        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8174      }
8175    }
8176    ;
8177    if (json.has("clinicalStatus"))
8178      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
8179    if (json.has("verificationStatus"))
8180      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
8181    if (json.has("category")) {
8182      JsonArray array = json.getAsJsonArray("category");
8183      for (int i = 0; i < array.size(); i++) {
8184        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8185      }
8186    }
8187    ;
8188    if (json.has("severity"))
8189      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
8190    if (json.has("code"))
8191      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8192    if (json.has("bodySite")) {
8193      JsonArray array = json.getAsJsonArray("bodySite");
8194      for (int i = 0; i < array.size(); i++) {
8195        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8196      }
8197    }
8198    ;
8199    if (json.has("subject"))
8200      res.setSubject(parseReference(getJObject(json, "subject")));
8201    if (json.has("encounter"))
8202      res.setEncounter(parseReference(getJObject(json, "encounter")));
8203    Type onset = parseType("onset", json);
8204    if (onset != null)
8205      res.setOnset(onset);
8206    Type abatement = parseType("abatement", json);
8207    if (abatement != null)
8208      res.setAbatement(abatement);
8209    if (json.has("recordedDate"))
8210      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
8211    if (json.has("_recordedDate"))
8212      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
8213    if (json.has("recorder"))
8214      res.setRecorder(parseReference(getJObject(json, "recorder")));
8215    if (json.has("asserter"))
8216      res.setAsserter(parseReference(getJObject(json, "asserter")));
8217    if (json.has("stage")) {
8218      JsonArray array = json.getAsJsonArray("stage");
8219      for (int i = 0; i < array.size(); i++) {
8220        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
8221      }
8222    }
8223    ;
8224    if (json.has("evidence")) {
8225      JsonArray array = json.getAsJsonArray("evidence");
8226      for (int i = 0; i < array.size(); i++) {
8227        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
8228      }
8229    }
8230    ;
8231    if (json.has("note")) {
8232      JsonArray array = json.getAsJsonArray("note");
8233      for (int i = 0; i < array.size(); i++) {
8234        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8235      }
8236    }
8237    ;
8238  }
8239
8240  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner)
8241      throws IOException, FHIRFormatError {
8242    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
8243    parseConditionConditionStageComponentProperties(json, owner, res);
8244    return res;
8245  }
8246
8247  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner,
8248      Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
8249    parseBackboneElementProperties(json, res);
8250    if (json.has("summary"))
8251      res.setSummary(parseCodeableConcept(getJObject(json, "summary")));
8252    if (json.has("assessment")) {
8253      JsonArray array = json.getAsJsonArray("assessment");
8254      for (int i = 0; i < array.size(); i++) {
8255        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
8256      }
8257    }
8258    ;
8259    if (json.has("type"))
8260      res.setType(parseCodeableConcept(getJObject(json, "type")));
8261  }
8262
8263  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json,
8264      Condition owner) throws IOException, FHIRFormatError {
8265    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
8266    parseConditionConditionEvidenceComponentProperties(json, owner, res);
8267    return res;
8268  }
8269
8270  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner,
8271      Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
8272    parseBackboneElementProperties(json, res);
8273    if (json.has("code")) {
8274      JsonArray array = json.getAsJsonArray("code");
8275      for (int i = 0; i < array.size(); i++) {
8276        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8277      }
8278    }
8279    ;
8280    if (json.has("detail")) {
8281      JsonArray array = json.getAsJsonArray("detail");
8282      for (int i = 0; i < array.size(); i++) {
8283        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8284      }
8285    }
8286    ;
8287  }
8288
8289  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
8290    Consent res = new Consent();
8291    parseConsentProperties(json, res);
8292    return res;
8293  }
8294
8295  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
8296    parseDomainResourceProperties(json, res);
8297    if (json.has("identifier")) {
8298      JsonArray array = json.getAsJsonArray("identifier");
8299      for (int i = 0; i < array.size(); i++) {
8300        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8301      }
8302    }
8303    ;
8304    if (json.has("status"))
8305      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL,
8306          new Consent.ConsentStateEnumFactory()));
8307    if (json.has("_status"))
8308      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8309    if (json.has("scope"))
8310      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
8311    if (json.has("category")) {
8312      JsonArray array = json.getAsJsonArray("category");
8313      for (int i = 0; i < array.size(); i++) {
8314        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8315      }
8316    }
8317    ;
8318    if (json.has("patient"))
8319      res.setPatient(parseReference(getJObject(json, "patient")));
8320    if (json.has("dateTime"))
8321      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
8322    if (json.has("_dateTime"))
8323      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
8324    if (json.has("performer")) {
8325      JsonArray array = json.getAsJsonArray("performer");
8326      for (int i = 0; i < array.size(); i++) {
8327        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
8328      }
8329    }
8330    ;
8331    if (json.has("organization")) {
8332      JsonArray array = json.getAsJsonArray("organization");
8333      for (int i = 0; i < array.size(); i++) {
8334        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
8335      }
8336    }
8337    ;
8338    Type source = parseType("source", json);
8339    if (source != null)
8340      res.setSource(source);
8341    if (json.has("policy")) {
8342      JsonArray array = json.getAsJsonArray("policy");
8343      for (int i = 0; i < array.size(); i++) {
8344        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
8345      }
8346    }
8347    ;
8348    if (json.has("policyRule"))
8349      res.setPolicyRule(parseCodeableConcept(getJObject(json, "policyRule")));
8350    if (json.has("verification")) {
8351      JsonArray array = json.getAsJsonArray("verification");
8352      for (int i = 0; i < array.size(); i++) {
8353        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
8354      }
8355    }
8356    ;
8357    if (json.has("provision"))
8358      res.setProvision(parseConsentprovisionComponent(getJObject(json, "provision"), res));
8359  }
8360
8361  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner)
8362      throws IOException, FHIRFormatError {
8363    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
8364    parseConsentConsentPolicyComponentProperties(json, owner, res);
8365    return res;
8366  }
8367
8368  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner,
8369      Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
8370    parseBackboneElementProperties(json, res);
8371    if (json.has("authority"))
8372      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
8373    if (json.has("_authority"))
8374      parseElementProperties(getJObject(json, "_authority"), res.getAuthorityElement());
8375    if (json.has("uri"))
8376      res.setUriElement(parseUri(json.get("uri").getAsString()));
8377    if (json.has("_uri"))
8378      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
8379  }
8380
8381  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json,
8382      Consent owner) throws IOException, FHIRFormatError {
8383    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
8384    parseConsentConsentVerificationComponentProperties(json, owner, res);
8385    return res;
8386  }
8387
8388  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner,
8389      Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
8390    parseBackboneElementProperties(json, res);
8391    if (json.has("verified"))
8392      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
8393    if (json.has("_verified"))
8394      parseElementProperties(getJObject(json, "_verified"), res.getVerifiedElement());
8395    if (json.has("verifiedWith"))
8396      res.setVerifiedWith(parseReference(getJObject(json, "verifiedWith")));
8397    if (json.has("verificationDate"))
8398      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
8399    if (json.has("_verificationDate"))
8400      parseElementProperties(getJObject(json, "_verificationDate"), res.getVerificationDateElement());
8401  }
8402
8403  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner)
8404      throws IOException, FHIRFormatError {
8405    Consent.provisionComponent res = new Consent.provisionComponent();
8406    parseConsentprovisionComponentProperties(json, owner, res);
8407    return res;
8408  }
8409
8410  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner,
8411      Consent.provisionComponent res) throws IOException, FHIRFormatError {
8412    parseBackboneElementProperties(json, res);
8413    if (json.has("type"))
8414      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL,
8415          new Consent.ConsentProvisionTypeEnumFactory()));
8416    if (json.has("_type"))
8417      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
8418    if (json.has("period"))
8419      res.setPeriod(parsePeriod(getJObject(json, "period")));
8420    if (json.has("actor")) {
8421      JsonArray array = json.getAsJsonArray("actor");
8422      for (int i = 0; i < array.size(); i++) {
8423        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
8424      }
8425    }
8426    ;
8427    if (json.has("action")) {
8428      JsonArray array = json.getAsJsonArray("action");
8429      for (int i = 0; i < array.size(); i++) {
8430        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8431      }
8432    }
8433    ;
8434    if (json.has("securityLabel")) {
8435      JsonArray array = json.getAsJsonArray("securityLabel");
8436      for (int i = 0; i < array.size(); i++) {
8437        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
8438      }
8439    }
8440    ;
8441    if (json.has("purpose")) {
8442      JsonArray array = json.getAsJsonArray("purpose");
8443      for (int i = 0; i < array.size(); i++) {
8444        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
8445      }
8446    }
8447    ;
8448    if (json.has("class")) {
8449      JsonArray array = json.getAsJsonArray("class");
8450      for (int i = 0; i < array.size(); i++) {
8451        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
8452      }
8453    }
8454    ;
8455    if (json.has("code")) {
8456      JsonArray array = json.getAsJsonArray("code");
8457      for (int i = 0; i < array.size(); i++) {
8458        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8459      }
8460    }
8461    ;
8462    if (json.has("dataPeriod"))
8463      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
8464    if (json.has("data")) {
8465      JsonArray array = json.getAsJsonArray("data");
8466      for (int i = 0; i < array.size(); i++) {
8467        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
8468      }
8469    }
8470    ;
8471    if (json.has("provision")) {
8472      JsonArray array = json.getAsJsonArray("provision");
8473      for (int i = 0; i < array.size(); i++) {
8474        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
8475      }
8476    }
8477    ;
8478  }
8479
8480  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner)
8481      throws IOException, FHIRFormatError {
8482    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
8483    parseConsentprovisionActorComponentProperties(json, owner, res);
8484    return res;
8485  }
8486
8487  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner,
8488      Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
8489    parseBackboneElementProperties(json, res);
8490    if (json.has("role"))
8491      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8492    if (json.has("reference"))
8493      res.setReference(parseReference(getJObject(json, "reference")));
8494  }
8495
8496  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner)
8497      throws IOException, FHIRFormatError {
8498    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
8499    parseConsentprovisionDataComponentProperties(json, owner, res);
8500    return res;
8501  }
8502
8503  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner,
8504      Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
8505    parseBackboneElementProperties(json, res);
8506    if (json.has("meaning"))
8507      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL,
8508          new Consent.ConsentDataMeaningEnumFactory()));
8509    if (json.has("_meaning"))
8510      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
8511    if (json.has("reference"))
8512      res.setReference(parseReference(getJObject(json, "reference")));
8513  }
8514
8515  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
8516    Contract res = new Contract();
8517    parseContractProperties(json, res);
8518    return res;
8519  }
8520
8521  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
8522    parseDomainResourceProperties(json, res);
8523    if (json.has("identifier")) {
8524      JsonArray array = json.getAsJsonArray("identifier");
8525      for (int i = 0; i < array.size(); i++) {
8526        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8527      }
8528    }
8529    ;
8530    if (json.has("url"))
8531      res.setUrlElement(parseUri(json.get("url").getAsString()));
8532    if (json.has("_url"))
8533      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8534    if (json.has("version"))
8535      res.setVersionElement(parseString(json.get("version").getAsString()));
8536    if (json.has("_version"))
8537      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8538    if (json.has("status"))
8539      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL,
8540          new Contract.ContractStatusEnumFactory()));
8541    if (json.has("_status"))
8542      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8543    if (json.has("legalState"))
8544      res.setLegalState(parseCodeableConcept(getJObject(json, "legalState")));
8545    if (json.has("instantiatesCanonical"))
8546      res.setInstantiatesCanonical(parseReference(getJObject(json, "instantiatesCanonical")));
8547    if (json.has("instantiatesUri"))
8548      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
8549    if (json.has("_instantiatesUri"))
8550      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
8551    if (json.has("contentDerivative"))
8552      res.setContentDerivative(parseCodeableConcept(getJObject(json, "contentDerivative")));
8553    if (json.has("issued"))
8554      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
8555    if (json.has("_issued"))
8556      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
8557    if (json.has("applies"))
8558      res.setApplies(parsePeriod(getJObject(json, "applies")));
8559    if (json.has("expirationType"))
8560      res.setExpirationType(parseCodeableConcept(getJObject(json, "expirationType")));
8561    if (json.has("subject")) {
8562      JsonArray array = json.getAsJsonArray("subject");
8563      for (int i = 0; i < array.size(); i++) {
8564        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
8565      }
8566    }
8567    ;
8568    if (json.has("authority")) {
8569      JsonArray array = json.getAsJsonArray("authority");
8570      for (int i = 0; i < array.size(); i++) {
8571        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
8572      }
8573    }
8574    ;
8575    if (json.has("domain")) {
8576      JsonArray array = json.getAsJsonArray("domain");
8577      for (int i = 0; i < array.size(); i++) {
8578        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
8579      }
8580    }
8581    ;
8582    if (json.has("site")) {
8583      JsonArray array = json.getAsJsonArray("site");
8584      for (int i = 0; i < array.size(); i++) {
8585        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
8586      }
8587    }
8588    ;
8589    if (json.has("name"))
8590      res.setNameElement(parseString(json.get("name").getAsString()));
8591    if (json.has("_name"))
8592      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8593    if (json.has("title"))
8594      res.setTitleElement(parseString(json.get("title").getAsString()));
8595    if (json.has("_title"))
8596      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
8597    if (json.has("subtitle"))
8598      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
8599    if (json.has("_subtitle"))
8600      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
8601    if (json.has("alias")) {
8602      JsonArray array = json.getAsJsonArray("alias");
8603      for (int i = 0; i < array.size(); i++) {
8604        if (array.get(i).isJsonNull()) {
8605          res.getAlias().add(new StringType());
8606        } else {
8607          res.getAlias().add(parseString(array.get(i).getAsString()));
8608        }
8609      }
8610    }
8611    ;
8612    if (json.has("_alias")) {
8613      JsonArray array = json.getAsJsonArray("_alias");
8614      for (int i = 0; i < array.size(); i++) {
8615        if (i == res.getAlias().size())
8616          res.getAlias().add(parseString(null));
8617        if (array.get(i) instanceof JsonObject)
8618          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
8619      }
8620    }
8621    ;
8622    if (json.has("author"))
8623      res.setAuthor(parseReference(getJObject(json, "author")));
8624    if (json.has("scope"))
8625      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
8626    Type topic = parseType("topic", json);
8627    if (topic != null)
8628      res.setTopic(topic);
8629    if (json.has("type"))
8630      res.setType(parseCodeableConcept(getJObject(json, "type")));
8631    if (json.has("subType")) {
8632      JsonArray array = json.getAsJsonArray("subType");
8633      for (int i = 0; i < array.size(); i++) {
8634        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8635      }
8636    }
8637    ;
8638    if (json.has("contentDefinition"))
8639      res.setContentDefinition(parseContractContentDefinitionComponent(getJObject(json, "contentDefinition"), res));
8640    if (json.has("term")) {
8641      JsonArray array = json.getAsJsonArray("term");
8642      for (int i = 0; i < array.size(); i++) {
8643        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
8644      }
8645    }
8646    ;
8647    if (json.has("supportingInfo")) {
8648      JsonArray array = json.getAsJsonArray("supportingInfo");
8649      for (int i = 0; i < array.size(); i++) {
8650        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
8651      }
8652    }
8653    ;
8654    if (json.has("relevantHistory")) {
8655      JsonArray array = json.getAsJsonArray("relevantHistory");
8656      for (int i = 0; i < array.size(); i++) {
8657        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
8658      }
8659    }
8660    ;
8661    if (json.has("signer")) {
8662      JsonArray array = json.getAsJsonArray("signer");
8663      for (int i = 0; i < array.size(); i++) {
8664        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
8665      }
8666    }
8667    ;
8668    if (json.has("friendly")) {
8669      JsonArray array = json.getAsJsonArray("friendly");
8670      for (int i = 0; i < array.size(); i++) {
8671        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
8672      }
8673    }
8674    ;
8675    if (json.has("legal")) {
8676      JsonArray array = json.getAsJsonArray("legal");
8677      for (int i = 0; i < array.size(); i++) {
8678        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
8679      }
8680    }
8681    ;
8682    if (json.has("rule")) {
8683      JsonArray array = json.getAsJsonArray("rule");
8684      for (int i = 0; i < array.size(); i++) {
8685        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
8686      }
8687    }
8688    ;
8689    Type legallyBinding = parseType("legallyBinding", json);
8690    if (legallyBinding != null)
8691      res.setLegallyBinding(legallyBinding);
8692  }
8693
8694  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json, Contract owner)
8695      throws IOException, FHIRFormatError {
8696    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
8697    parseContractContentDefinitionComponentProperties(json, owner, res);
8698    return res;
8699  }
8700
8701  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract owner,
8702      Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
8703    parseBackboneElementProperties(json, res);
8704    if (json.has("type"))
8705      res.setType(parseCodeableConcept(getJObject(json, "type")));
8706    if (json.has("subType"))
8707      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
8708    if (json.has("publisher"))
8709      res.setPublisher(parseReference(getJObject(json, "publisher")));
8710    if (json.has("publicationDate"))
8711      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
8712    if (json.has("_publicationDate"))
8713      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
8714    if (json.has("publicationStatus"))
8715      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(),
8716          Contract.ContractPublicationStatus.NULL, new Contract.ContractPublicationStatusEnumFactory()));
8717    if (json.has("_publicationStatus"))
8718      parseElementProperties(getJObject(json, "_publicationStatus"), res.getPublicationStatusElement());
8719    if (json.has("copyright"))
8720      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8721    if (json.has("_copyright"))
8722      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
8723  }
8724
8725  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner)
8726      throws IOException, FHIRFormatError {
8727    Contract.TermComponent res = new Contract.TermComponent();
8728    parseContractTermComponentProperties(json, owner, res);
8729    return res;
8730  }
8731
8732  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res)
8733      throws IOException, FHIRFormatError {
8734    parseBackboneElementProperties(json, res);
8735    if (json.has("identifier"))
8736      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8737    if (json.has("issued"))
8738      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
8739    if (json.has("_issued"))
8740      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
8741    if (json.has("applies"))
8742      res.setApplies(parsePeriod(getJObject(json, "applies")));
8743    Type topic = parseType("topic", json);
8744    if (topic != null)
8745      res.setTopic(topic);
8746    if (json.has("type"))
8747      res.setType(parseCodeableConcept(getJObject(json, "type")));
8748    if (json.has("subType"))
8749      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
8750    if (json.has("text"))
8751      res.setTextElement(parseString(json.get("text").getAsString()));
8752    if (json.has("_text"))
8753      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
8754    if (json.has("securityLabel")) {
8755      JsonArray array = json.getAsJsonArray("securityLabel");
8756      for (int i = 0; i < array.size(); i++) {
8757        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject(), owner));
8758      }
8759    }
8760    ;
8761    if (json.has("offer"))
8762      res.setOffer(parseContractContractOfferComponent(getJObject(json, "offer"), owner));
8763    if (json.has("asset")) {
8764      JsonArray array = json.getAsJsonArray("asset");
8765      for (int i = 0; i < array.size(); i++) {
8766        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
8767      }
8768    }
8769    ;
8770    if (json.has("action")) {
8771      JsonArray array = json.getAsJsonArray("action");
8772      for (int i = 0; i < array.size(); i++) {
8773        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject(), owner));
8774      }
8775    }
8776    ;
8777    if (json.has("group")) {
8778      JsonArray array = json.getAsJsonArray("group");
8779      for (int i = 0; i < array.size(); i++) {
8780        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
8781      }
8782    }
8783    ;
8784  }
8785
8786  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json, Contract owner)
8787      throws IOException, FHIRFormatError {
8788    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
8789    parseContractSecurityLabelComponentProperties(json, owner, res);
8790    return res;
8791  }
8792
8793  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract owner,
8794      Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
8795    parseBackboneElementProperties(json, res);
8796    if (json.has("number")) {
8797      JsonArray array = json.getAsJsonArray("number");
8798      for (int i = 0; i < array.size(); i++) {
8799        if (array.get(i).isJsonNull()) {
8800          res.getNumber().add(new UnsignedIntType());
8801        } else {
8802          res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8803        }
8804      }
8805    }
8806    ;
8807    if (json.has("_number")) {
8808      JsonArray array = json.getAsJsonArray("_number");
8809      for (int i = 0; i < array.size(); i++) {
8810        if (i == res.getNumber().size())
8811          res.getNumber().add(parseUnsignedInt(null));
8812        if (array.get(i) instanceof JsonObject)
8813          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
8814      }
8815    }
8816    ;
8817    if (json.has("classification"))
8818      res.setClassification(parseCoding(getJObject(json, "classification")));
8819    if (json.has("category")) {
8820      JsonArray array = json.getAsJsonArray("category");
8821      for (int i = 0; i < array.size(); i++) {
8822        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
8823      }
8824    }
8825    ;
8826    if (json.has("control")) {
8827      JsonArray array = json.getAsJsonArray("control");
8828      for (int i = 0; i < array.size(); i++) {
8829        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
8830      }
8831    }
8832    ;
8833  }
8834
8835  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner)
8836      throws IOException, FHIRFormatError {
8837    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
8838    parseContractContractOfferComponentProperties(json, owner, res);
8839    return res;
8840  }
8841
8842  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner,
8843      Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
8844    parseBackboneElementProperties(json, res);
8845    if (json.has("identifier")) {
8846      JsonArray array = json.getAsJsonArray("identifier");
8847      for (int i = 0; i < array.size(); i++) {
8848        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8849      }
8850    }
8851    ;
8852    if (json.has("party")) {
8853      JsonArray array = json.getAsJsonArray("party");
8854      for (int i = 0; i < array.size(); i++) {
8855        res.getParty().add(parseContractContractPartyComponent(array.get(i).getAsJsonObject(), owner));
8856      }
8857    }
8858    ;
8859    if (json.has("topic"))
8860      res.setTopic(parseReference(getJObject(json, "topic")));
8861    if (json.has("type"))
8862      res.setType(parseCodeableConcept(getJObject(json, "type")));
8863    if (json.has("decision"))
8864      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
8865    if (json.has("decisionMode")) {
8866      JsonArray array = json.getAsJsonArray("decisionMode");
8867      for (int i = 0; i < array.size(); i++) {
8868        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8869      }
8870    }
8871    ;
8872    if (json.has("answer")) {
8873      JsonArray array = json.getAsJsonArray("answer");
8874      for (int i = 0; i < array.size(); i++) {
8875        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
8876      }
8877    }
8878    ;
8879    if (json.has("text"))
8880      res.setTextElement(parseString(json.get("text").getAsString()));
8881    if (json.has("_text"))
8882      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
8883    if (json.has("linkId")) {
8884      JsonArray array = json.getAsJsonArray("linkId");
8885      for (int i = 0; i < array.size(); i++) {
8886        if (array.get(i).isJsonNull()) {
8887          res.getLinkId().add(new StringType());
8888        } else {
8889          res.getLinkId().add(parseString(array.get(i).getAsString()));
8890        }
8891      }
8892    }
8893    ;
8894    if (json.has("_linkId")) {
8895      JsonArray array = json.getAsJsonArray("_linkId");
8896      for (int i = 0; i < array.size(); i++) {
8897        if (i == res.getLinkId().size())
8898          res.getLinkId().add(parseString(null));
8899        if (array.get(i) instanceof JsonObject)
8900          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8901      }
8902    }
8903    ;
8904    if (json.has("securityLabelNumber")) {
8905      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8906      for (int i = 0; i < array.size(); i++) {
8907        if (array.get(i).isJsonNull()) {
8908          res.getSecurityLabelNumber().add(new UnsignedIntType());
8909        } else {
8910          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8911        }
8912      }
8913    }
8914    ;
8915    if (json.has("_securityLabelNumber")) {
8916      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8917      for (int i = 0; i < array.size(); i++) {
8918        if (i == res.getSecurityLabelNumber().size())
8919          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8920        if (array.get(i) instanceof JsonObject)
8921          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8922      }
8923    }
8924    ;
8925  }
8926
8927  protected Contract.ContractPartyComponent parseContractContractPartyComponent(JsonObject json, Contract owner)
8928      throws IOException, FHIRFormatError {
8929    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
8930    parseContractContractPartyComponentProperties(json, owner, res);
8931    return res;
8932  }
8933
8934  protected void parseContractContractPartyComponentProperties(JsonObject json, Contract owner,
8935      Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
8936    parseBackboneElementProperties(json, res);
8937    if (json.has("reference")) {
8938      JsonArray array = json.getAsJsonArray("reference");
8939      for (int i = 0; i < array.size(); i++) {
8940        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8941      }
8942    }
8943    ;
8944    if (json.has("role"))
8945      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8946  }
8947
8948  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json, Contract owner)
8949      throws IOException, FHIRFormatError {
8950    Contract.AnswerComponent res = new Contract.AnswerComponent();
8951    parseContractAnswerComponentProperties(json, owner, res);
8952    return res;
8953  }
8954
8955  protected void parseContractAnswerComponentProperties(JsonObject json, Contract owner, Contract.AnswerComponent res)
8956      throws IOException, FHIRFormatError {
8957    parseBackboneElementProperties(json, res);
8958    Type value = parseType("value", json);
8959    if (value != null)
8960      res.setValue(value);
8961  }
8962
8963  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner)
8964      throws IOException, FHIRFormatError {
8965    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
8966    parseContractContractAssetComponentProperties(json, owner, res);
8967    return res;
8968  }
8969
8970  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner,
8971      Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
8972    parseBackboneElementProperties(json, res);
8973    if (json.has("scope"))
8974      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
8975    if (json.has("type")) {
8976      JsonArray array = json.getAsJsonArray("type");
8977      for (int i = 0; i < array.size(); i++) {
8978        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8979      }
8980    }
8981    ;
8982    if (json.has("typeReference")) {
8983      JsonArray array = json.getAsJsonArray("typeReference");
8984      for (int i = 0; i < array.size(); i++) {
8985        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
8986      }
8987    }
8988    ;
8989    if (json.has("subtype")) {
8990      JsonArray array = json.getAsJsonArray("subtype");
8991      for (int i = 0; i < array.size(); i++) {
8992        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8993      }
8994    }
8995    ;
8996    if (json.has("relationship"))
8997      res.setRelationship(parseCoding(getJObject(json, "relationship")));
8998    if (json.has("context")) {
8999      JsonArray array = json.getAsJsonArray("context");
9000      for (int i = 0; i < array.size(); i++) {
9001        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject(), owner));
9002      }
9003    }
9004    ;
9005    if (json.has("condition"))
9006      res.setConditionElement(parseString(json.get("condition").getAsString()));
9007    if (json.has("_condition"))
9008      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
9009    if (json.has("periodType")) {
9010      JsonArray array = json.getAsJsonArray("periodType");
9011      for (int i = 0; i < array.size(); i++) {
9012        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9013      }
9014    }
9015    ;
9016    if (json.has("period")) {
9017      JsonArray array = json.getAsJsonArray("period");
9018      for (int i = 0; i < array.size(); i++) {
9019        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9020      }
9021    }
9022    ;
9023    if (json.has("usePeriod")) {
9024      JsonArray array = json.getAsJsonArray("usePeriod");
9025      for (int i = 0; i < array.size(); i++) {
9026        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9027      }
9028    }
9029    ;
9030    if (json.has("text"))
9031      res.setTextElement(parseString(json.get("text").getAsString()));
9032    if (json.has("_text"))
9033      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
9034    if (json.has("linkId")) {
9035      JsonArray array = json.getAsJsonArray("linkId");
9036      for (int i = 0; i < array.size(); i++) {
9037        if (array.get(i).isJsonNull()) {
9038          res.getLinkId().add(new StringType());
9039        } else {
9040          res.getLinkId().add(parseString(array.get(i).getAsString()));
9041        }
9042      }
9043    }
9044    ;
9045    if (json.has("_linkId")) {
9046      JsonArray array = json.getAsJsonArray("_linkId");
9047      for (int i = 0; i < array.size(); i++) {
9048        if (i == res.getLinkId().size())
9049          res.getLinkId().add(parseString(null));
9050        if (array.get(i) instanceof JsonObject)
9051          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9052      }
9053    }
9054    ;
9055    if (json.has("answer")) {
9056      JsonArray array = json.getAsJsonArray("answer");
9057      for (int i = 0; i < array.size(); i++) {
9058        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
9059      }
9060    }
9061    ;
9062    if (json.has("securityLabelNumber")) {
9063      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9064      for (int i = 0; i < array.size(); i++) {
9065        if (array.get(i).isJsonNull()) {
9066          res.getSecurityLabelNumber().add(new UnsignedIntType());
9067        } else {
9068          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9069        }
9070      }
9071    }
9072    ;
9073    if (json.has("_securityLabelNumber")) {
9074      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9075      for (int i = 0; i < array.size(); i++) {
9076        if (i == res.getSecurityLabelNumber().size())
9077          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9078        if (array.get(i) instanceof JsonObject)
9079          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9080      }
9081    }
9082    ;
9083    if (json.has("valuedItem")) {
9084      JsonArray array = json.getAsJsonArray("valuedItem");
9085      for (int i = 0; i < array.size(); i++) {
9086        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
9087      }
9088    }
9089    ;
9090  }
9091
9092  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json, Contract owner)
9093      throws IOException, FHIRFormatError {
9094    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
9095    parseContractAssetContextComponentProperties(json, owner, res);
9096    return res;
9097  }
9098
9099  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract owner,
9100      Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
9101    parseBackboneElementProperties(json, res);
9102    if (json.has("reference"))
9103      res.setReference(parseReference(getJObject(json, "reference")));
9104    if (json.has("code")) {
9105      JsonArray array = json.getAsJsonArray("code");
9106      for (int i = 0; i < array.size(); i++) {
9107        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9108      }
9109    }
9110    ;
9111    if (json.has("text"))
9112      res.setTextElement(parseString(json.get("text").getAsString()));
9113    if (json.has("_text"))
9114      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
9115  }
9116
9117  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner)
9118      throws IOException, FHIRFormatError {
9119    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
9120    parseContractValuedItemComponentProperties(json, owner, res);
9121    return res;
9122  }
9123
9124  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner,
9125      Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
9126    parseBackboneElementProperties(json, res);
9127    Type entity = parseType("entity", json);
9128    if (entity != null)
9129      res.setEntity(entity);
9130    if (json.has("identifier"))
9131      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
9132    if (json.has("effectiveTime"))
9133      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
9134    if (json.has("_effectiveTime"))
9135      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
9136    if (json.has("quantity"))
9137      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
9138    if (json.has("unitPrice"))
9139      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
9140    if (json.has("factor"))
9141      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9142    if (json.has("_factor"))
9143      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
9144    if (json.has("points"))
9145      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
9146    if (json.has("_points"))
9147      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
9148    if (json.has("net"))
9149      res.setNet(parseMoney(getJObject(json, "net")));
9150    if (json.has("payment"))
9151      res.setPaymentElement(parseString(json.get("payment").getAsString()));
9152    if (json.has("_payment"))
9153      parseElementProperties(getJObject(json, "_payment"), res.getPaymentElement());
9154    if (json.has("paymentDate"))
9155      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
9156    if (json.has("_paymentDate"))
9157      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
9158    if (json.has("responsible"))
9159      res.setResponsible(parseReference(getJObject(json, "responsible")));
9160    if (json.has("recipient"))
9161      res.setRecipient(parseReference(getJObject(json, "recipient")));
9162    if (json.has("linkId")) {
9163      JsonArray array = json.getAsJsonArray("linkId");
9164      for (int i = 0; i < array.size(); i++) {
9165        if (array.get(i).isJsonNull()) {
9166          res.getLinkId().add(new StringType());
9167        } else {
9168          res.getLinkId().add(parseString(array.get(i).getAsString()));
9169        }
9170      }
9171    }
9172    ;
9173    if (json.has("_linkId")) {
9174      JsonArray array = json.getAsJsonArray("_linkId");
9175      for (int i = 0; i < array.size(); i++) {
9176        if (i == res.getLinkId().size())
9177          res.getLinkId().add(parseString(null));
9178        if (array.get(i) instanceof JsonObject)
9179          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9180      }
9181    }
9182    ;
9183    if (json.has("securityLabelNumber")) {
9184      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9185      for (int i = 0; i < array.size(); i++) {
9186        if (array.get(i).isJsonNull()) {
9187          res.getSecurityLabelNumber().add(new UnsignedIntType());
9188        } else {
9189          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9190        }
9191      }
9192    }
9193    ;
9194    if (json.has("_securityLabelNumber")) {
9195      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9196      for (int i = 0; i < array.size(); i++) {
9197        if (i == res.getSecurityLabelNumber().size())
9198          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9199        if (array.get(i) instanceof JsonObject)
9200          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9201      }
9202    }
9203    ;
9204  }
9205
9206  protected Contract.ActionComponent parseContractActionComponent(JsonObject json, Contract owner)
9207      throws IOException, FHIRFormatError {
9208    Contract.ActionComponent res = new Contract.ActionComponent();
9209    parseContractActionComponentProperties(json, owner, res);
9210    return res;
9211  }
9212
9213  protected void parseContractActionComponentProperties(JsonObject json, Contract owner, Contract.ActionComponent res)
9214      throws IOException, FHIRFormatError {
9215    parseBackboneElementProperties(json, res);
9216    if (json.has("doNotPerform"))
9217      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
9218    if (json.has("_doNotPerform"))
9219      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
9220    if (json.has("type"))
9221      res.setType(parseCodeableConcept(getJObject(json, "type")));
9222    if (json.has("subject")) {
9223      JsonArray array = json.getAsJsonArray("subject");
9224      for (int i = 0; i < array.size(); i++) {
9225        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject(), owner));
9226      }
9227    }
9228    ;
9229    if (json.has("intent"))
9230      res.setIntent(parseCodeableConcept(getJObject(json, "intent")));
9231    if (json.has("linkId")) {
9232      JsonArray array = json.getAsJsonArray("linkId");
9233      for (int i = 0; i < array.size(); i++) {
9234        if (array.get(i).isJsonNull()) {
9235          res.getLinkId().add(new StringType());
9236        } else {
9237          res.getLinkId().add(parseString(array.get(i).getAsString()));
9238        }
9239      }
9240    }
9241    ;
9242    if (json.has("_linkId")) {
9243      JsonArray array = json.getAsJsonArray("_linkId");
9244      for (int i = 0; i < array.size(); i++) {
9245        if (i == res.getLinkId().size())
9246          res.getLinkId().add(parseString(null));
9247        if (array.get(i) instanceof JsonObject)
9248          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9249      }
9250    }
9251    ;
9252    if (json.has("status"))
9253      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
9254    if (json.has("context"))
9255      res.setContext(parseReference(getJObject(json, "context")));
9256    if (json.has("contextLinkId")) {
9257      JsonArray array = json.getAsJsonArray("contextLinkId");
9258      for (int i = 0; i < array.size(); i++) {
9259        if (array.get(i).isJsonNull()) {
9260          res.getContextLinkId().add(new StringType());
9261        } else {
9262          res.getContextLinkId().add(parseString(array.get(i).getAsString()));
9263        }
9264      }
9265    }
9266    ;
9267    if (json.has("_contextLinkId")) {
9268      JsonArray array = json.getAsJsonArray("_contextLinkId");
9269      for (int i = 0; i < array.size(); i++) {
9270        if (i == res.getContextLinkId().size())
9271          res.getContextLinkId().add(parseString(null));
9272        if (array.get(i) instanceof JsonObject)
9273          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
9274      }
9275    }
9276    ;
9277    Type occurrence = parseType("occurrence", json);
9278    if (occurrence != null)
9279      res.setOccurrence(occurrence);
9280    if (json.has("requester")) {
9281      JsonArray array = json.getAsJsonArray("requester");
9282      for (int i = 0; i < array.size(); i++) {
9283        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
9284      }
9285    }
9286    ;
9287    if (json.has("requesterLinkId")) {
9288      JsonArray array = json.getAsJsonArray("requesterLinkId");
9289      for (int i = 0; i < array.size(); i++) {
9290        if (array.get(i).isJsonNull()) {
9291          res.getRequesterLinkId().add(new StringType());
9292        } else {
9293          res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
9294        }
9295      }
9296    }
9297    ;
9298    if (json.has("_requesterLinkId")) {
9299      JsonArray array = json.getAsJsonArray("_requesterLinkId");
9300      for (int i = 0; i < array.size(); i++) {
9301        if (i == res.getRequesterLinkId().size())
9302          res.getRequesterLinkId().add(parseString(null));
9303        if (array.get(i) instanceof JsonObject)
9304          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
9305      }
9306    }
9307    ;
9308    if (json.has("performerType")) {
9309      JsonArray array = json.getAsJsonArray("performerType");
9310      for (int i = 0; i < array.size(); i++) {
9311        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9312      }
9313    }
9314    ;
9315    if (json.has("performerRole"))
9316      res.setPerformerRole(parseCodeableConcept(getJObject(json, "performerRole")));
9317    if (json.has("performer"))
9318      res.setPerformer(parseReference(getJObject(json, "performer")));
9319    if (json.has("performerLinkId")) {
9320      JsonArray array = json.getAsJsonArray("performerLinkId");
9321      for (int i = 0; i < array.size(); i++) {
9322        if (array.get(i).isJsonNull()) {
9323          res.getPerformerLinkId().add(new StringType());
9324        } else {
9325          res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
9326        }
9327      }
9328    }
9329    ;
9330    if (json.has("_performerLinkId")) {
9331      JsonArray array = json.getAsJsonArray("_performerLinkId");
9332      for (int i = 0; i < array.size(); i++) {
9333        if (i == res.getPerformerLinkId().size())
9334          res.getPerformerLinkId().add(parseString(null));
9335        if (array.get(i) instanceof JsonObject)
9336          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
9337      }
9338    }
9339    ;
9340    if (json.has("reasonCode")) {
9341      JsonArray array = json.getAsJsonArray("reasonCode");
9342      for (int i = 0; i < array.size(); i++) {
9343        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9344      }
9345    }
9346    ;
9347    if (json.has("reasonReference")) {
9348      JsonArray array = json.getAsJsonArray("reasonReference");
9349      for (int i = 0; i < array.size(); i++) {
9350        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9351      }
9352    }
9353    ;
9354    if (json.has("reason")) {
9355      JsonArray array = json.getAsJsonArray("reason");
9356      for (int i = 0; i < array.size(); i++) {
9357        if (array.get(i).isJsonNull()) {
9358          res.getReason().add(new StringType());
9359        } else {
9360          res.getReason().add(parseString(array.get(i).getAsString()));
9361        }
9362      }
9363    }
9364    ;
9365    if (json.has("_reason")) {
9366      JsonArray array = json.getAsJsonArray("_reason");
9367      for (int i = 0; i < array.size(); i++) {
9368        if (i == res.getReason().size())
9369          res.getReason().add(parseString(null));
9370        if (array.get(i) instanceof JsonObject)
9371          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
9372      }
9373    }
9374    ;
9375    if (json.has("reasonLinkId")) {
9376      JsonArray array = json.getAsJsonArray("reasonLinkId");
9377      for (int i = 0; i < array.size(); i++) {
9378        if (array.get(i).isJsonNull()) {
9379          res.getReasonLinkId().add(new StringType());
9380        } else {
9381          res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
9382        }
9383      }
9384    }
9385    ;
9386    if (json.has("_reasonLinkId")) {
9387      JsonArray array = json.getAsJsonArray("_reasonLinkId");
9388      for (int i = 0; i < array.size(); i++) {
9389        if (i == res.getReasonLinkId().size())
9390          res.getReasonLinkId().add(parseString(null));
9391        if (array.get(i) instanceof JsonObject)
9392          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
9393      }
9394    }
9395    ;
9396    if (json.has("note")) {
9397      JsonArray array = json.getAsJsonArray("note");
9398      for (int i = 0; i < array.size(); i++) {
9399        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9400      }
9401    }
9402    ;
9403    if (json.has("securityLabelNumber")) {
9404      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9405      for (int i = 0; i < array.size(); i++) {
9406        if (array.get(i).isJsonNull()) {
9407          res.getSecurityLabelNumber().add(new UnsignedIntType());
9408        } else {
9409          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9410        }
9411      }
9412    }
9413    ;
9414    if (json.has("_securityLabelNumber")) {
9415      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9416      for (int i = 0; i < array.size(); i++) {
9417        if (i == res.getSecurityLabelNumber().size())
9418          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9419        if (array.get(i) instanceof JsonObject)
9420          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9421      }
9422    }
9423    ;
9424  }
9425
9426  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json, Contract owner)
9427      throws IOException, FHIRFormatError {
9428    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
9429    parseContractActionSubjectComponentProperties(json, owner, res);
9430    return res;
9431  }
9432
9433  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract owner,
9434      Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
9435    parseBackboneElementProperties(json, res);
9436    if (json.has("reference")) {
9437      JsonArray array = json.getAsJsonArray("reference");
9438      for (int i = 0; i < array.size(); i++) {
9439        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
9440      }
9441    }
9442    ;
9443    if (json.has("role"))
9444      res.setRole(parseCodeableConcept(getJObject(json, "role")));
9445  }
9446
9447  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner)
9448      throws IOException, FHIRFormatError {
9449    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
9450    parseContractSignatoryComponentProperties(json, owner, res);
9451    return res;
9452  }
9453
9454  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner,
9455      Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
9456    parseBackboneElementProperties(json, res);
9457    if (json.has("type"))
9458      res.setType(parseCoding(getJObject(json, "type")));
9459    if (json.has("party"))
9460      res.setParty(parseReference(getJObject(json, "party")));
9461    if (json.has("signature")) {
9462      JsonArray array = json.getAsJsonArray("signature");
9463      for (int i = 0; i < array.size(); i++) {
9464        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
9465      }
9466    }
9467    ;
9468  }
9469
9470  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner)
9471      throws IOException, FHIRFormatError {
9472    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
9473    parseContractFriendlyLanguageComponentProperties(json, owner, res);
9474    return res;
9475  }
9476
9477  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner,
9478      Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
9479    parseBackboneElementProperties(json, res);
9480    Type content = parseType("content", json);
9481    if (content != null)
9482      res.setContent(content);
9483  }
9484
9485  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner)
9486      throws IOException, FHIRFormatError {
9487    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
9488    parseContractLegalLanguageComponentProperties(json, owner, res);
9489    return res;
9490  }
9491
9492  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner,
9493      Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
9494    parseBackboneElementProperties(json, res);
9495    Type content = parseType("content", json);
9496    if (content != null)
9497      res.setContent(content);
9498  }
9499
9500  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json,
9501      Contract owner) throws IOException, FHIRFormatError {
9502    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
9503    parseContractComputableLanguageComponentProperties(json, owner, res);
9504    return res;
9505  }
9506
9507  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner,
9508      Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
9509    parseBackboneElementProperties(json, res);
9510    Type content = parseType("content", json);
9511    if (content != null)
9512      res.setContent(content);
9513  }
9514
9515  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
9516    Coverage res = new Coverage();
9517    parseCoverageProperties(json, res);
9518    return res;
9519  }
9520
9521  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
9522    parseDomainResourceProperties(json, res);
9523    if (json.has("identifier")) {
9524      JsonArray array = json.getAsJsonArray("identifier");
9525      for (int i = 0; i < array.size(); i++) {
9526        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9527      }
9528    }
9529    ;
9530    if (json.has("status"))
9531      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL,
9532          new Coverage.CoverageStatusEnumFactory()));
9533    if (json.has("_status"))
9534      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9535    if (json.has("type"))
9536      res.setType(parseCodeableConcept(getJObject(json, "type")));
9537    if (json.has("policyHolder"))
9538      res.setPolicyHolder(parseReference(getJObject(json, "policyHolder")));
9539    if (json.has("subscriber"))
9540      res.setSubscriber(parseReference(getJObject(json, "subscriber")));
9541    if (json.has("subscriberId"))
9542      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
9543    if (json.has("_subscriberId"))
9544      parseElementProperties(getJObject(json, "_subscriberId"), res.getSubscriberIdElement());
9545    if (json.has("beneficiary"))
9546      res.setBeneficiary(parseReference(getJObject(json, "beneficiary")));
9547    if (json.has("dependent"))
9548      res.setDependentElement(parseString(json.get("dependent").getAsString()));
9549    if (json.has("_dependent"))
9550      parseElementProperties(getJObject(json, "_dependent"), res.getDependentElement());
9551    if (json.has("relationship"))
9552      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
9553    if (json.has("period"))
9554      res.setPeriod(parsePeriod(getJObject(json, "period")));
9555    if (json.has("payor")) {
9556      JsonArray array = json.getAsJsonArray("payor");
9557      for (int i = 0; i < array.size(); i++) {
9558        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
9559      }
9560    }
9561    ;
9562    if (json.has("class")) {
9563      JsonArray array = json.getAsJsonArray("class");
9564      for (int i = 0; i < array.size(); i++) {
9565        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
9566      }
9567    }
9568    ;
9569    if (json.has("order"))
9570      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
9571    if (json.has("_order"))
9572      parseElementProperties(getJObject(json, "_order"), res.getOrderElement());
9573    if (json.has("network"))
9574      res.setNetworkElement(parseString(json.get("network").getAsString()));
9575    if (json.has("_network"))
9576      parseElementProperties(getJObject(json, "_network"), res.getNetworkElement());
9577    if (json.has("costToBeneficiary")) {
9578      JsonArray array = json.getAsJsonArray("costToBeneficiary");
9579      for (int i = 0; i < array.size(); i++) {
9580        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject(), res));
9581      }
9582    }
9583    ;
9584    if (json.has("subrogation"))
9585      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
9586    if (json.has("_subrogation"))
9587      parseElementProperties(getJObject(json, "_subrogation"), res.getSubrogationElement());
9588    if (json.has("contract")) {
9589      JsonArray array = json.getAsJsonArray("contract");
9590      for (int i = 0; i < array.size(); i++) {
9591        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
9592      }
9593    }
9594    ;
9595  }
9596
9597  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner)
9598      throws IOException, FHIRFormatError {
9599    Coverage.ClassComponent res = new Coverage.ClassComponent();
9600    parseCoverageClassComponentProperties(json, owner, res);
9601    return res;
9602  }
9603
9604  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res)
9605      throws IOException, FHIRFormatError {
9606    parseBackboneElementProperties(json, res);
9607    if (json.has("type"))
9608      res.setType(parseCodeableConcept(getJObject(json, "type")));
9609    if (json.has("value"))
9610      res.setValueElement(parseString(json.get("value").getAsString()));
9611    if (json.has("_value"))
9612      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
9613    if (json.has("name"))
9614      res.setNameElement(parseString(json.get("name").getAsString()));
9615    if (json.has("_name"))
9616      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9617  }
9618
9619  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json, Coverage owner)
9620      throws IOException, FHIRFormatError {
9621    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
9622    parseCoverageCostToBeneficiaryComponentProperties(json, owner, res);
9623    return res;
9624  }
9625
9626  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage owner,
9627      Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
9628    parseBackboneElementProperties(json, res);
9629    if (json.has("type"))
9630      res.setType(parseCodeableConcept(getJObject(json, "type")));
9631    Type value = parseType("value", json);
9632    if (value != null)
9633      res.setValue(value);
9634    if (json.has("exception")) {
9635      JsonArray array = json.getAsJsonArray("exception");
9636      for (int i = 0; i < array.size(); i++) {
9637        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject(), owner));
9638      }
9639    }
9640    ;
9641  }
9642
9643  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json, Coverage owner)
9644      throws IOException, FHIRFormatError {
9645    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
9646    parseCoverageExemptionComponentProperties(json, owner, res);
9647    return res;
9648  }
9649
9650  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage owner,
9651      Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
9652    parseBackboneElementProperties(json, res);
9653    if (json.has("type"))
9654      res.setType(parseCodeableConcept(getJObject(json, "type")));
9655    if (json.has("period"))
9656      res.setPeriod(parsePeriod(getJObject(json, "period")));
9657  }
9658
9659  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json)
9660      throws IOException, FHIRFormatError {
9661    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
9662    parseCoverageEligibilityRequestProperties(json, res);
9663    return res;
9664  }
9665
9666  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res)
9667      throws IOException, FHIRFormatError {
9668    parseDomainResourceProperties(json, res);
9669    if (json.has("identifier")) {
9670      JsonArray array = json.getAsJsonArray("identifier");
9671      for (int i = 0; i < array.size(); i++) {
9672        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9673      }
9674    }
9675    ;
9676    if (json.has("status"))
9677      res.setStatusElement(
9678          parseEnumeration(json.get("status").getAsString(), CoverageEligibilityRequest.EligibilityRequestStatus.NULL,
9679              new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
9680    if (json.has("_status"))
9681      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9682    if (json.has("priority"))
9683      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
9684    if (json.has("purpose")) {
9685      JsonArray array = json.getAsJsonArray("purpose");
9686      for (int i = 0; i < array.size(); i++) {
9687        if (array.get(i).isJsonNull()) {
9688          res.getPurpose().add(new Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose>());
9689        } else {
9690          res.getPurpose()
9691              .add(parseEnumeration(array.get(i).getAsString(),
9692                  CoverageEligibilityRequest.EligibilityRequestPurpose.NULL,
9693                  new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9694        }
9695      }
9696    }
9697    ;
9698    if (json.has("_purpose")) {
9699      JsonArray array = json.getAsJsonArray("_purpose");
9700      for (int i = 0; i < array.size(); i++) {
9701        if (i == res.getPurpose().size())
9702          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL,
9703              new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9704        if (array.get(i) instanceof JsonObject)
9705          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
9706      }
9707    }
9708    ;
9709    if (json.has("patient"))
9710      res.setPatient(parseReference(getJObject(json, "patient")));
9711    Type serviced = parseType("serviced", json);
9712    if (serviced != null)
9713      res.setServiced(serviced);
9714    if (json.has("created"))
9715      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9716    if (json.has("_created"))
9717      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
9718    if (json.has("enterer"))
9719      res.setEnterer(parseReference(getJObject(json, "enterer")));
9720    if (json.has("provider"))
9721      res.setProvider(parseReference(getJObject(json, "provider")));
9722    if (json.has("insurer"))
9723      res.setInsurer(parseReference(getJObject(json, "insurer")));
9724    if (json.has("facility"))
9725      res.setFacility(parseReference(getJObject(json, "facility")));
9726    if (json.has("supportingInfo")) {
9727      JsonArray array = json.getAsJsonArray("supportingInfo");
9728      for (int i = 0; i < array.size(); i++) {
9729        res.getSupportingInfo()
9730            .add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
9731      }
9732    }
9733    ;
9734    if (json.has("insurance")) {
9735      JsonArray array = json.getAsJsonArray("insurance");
9736      for (int i = 0; i < array.size(); i++) {
9737        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject(), res));
9738      }
9739    }
9740    ;
9741    if (json.has("item")) {
9742      JsonArray array = json.getAsJsonArray("item");
9743      for (int i = 0; i < array.size(); i++) {
9744        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject(), res));
9745      }
9746    }
9747    ;
9748  }
9749
9750  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(
9751      JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9752    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
9753    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, owner, res);
9754    return res;
9755  }
9756
9757  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json,
9758      CoverageEligibilityRequest owner, CoverageEligibilityRequest.SupportingInformationComponent res)
9759      throws IOException, FHIRFormatError {
9760    parseBackboneElementProperties(json, res);
9761    if (json.has("sequence"))
9762      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9763    if (json.has("_sequence"))
9764      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9765    if (json.has("information"))
9766      res.setInformation(parseReference(getJObject(json, "information")));
9767    if (json.has("appliesToAll"))
9768      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
9769    if (json.has("_appliesToAll"))
9770      parseElementProperties(getJObject(json, "_appliesToAll"), res.getAppliesToAllElement());
9771  }
9772
9773  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(
9774      JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9775    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
9776    parseCoverageEligibilityRequestInsuranceComponentProperties(json, owner, res);
9777    return res;
9778  }
9779
9780  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json,
9781      CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res)
9782      throws IOException, FHIRFormatError {
9783    parseBackboneElementProperties(json, res);
9784    if (json.has("focal"))
9785      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
9786    if (json.has("_focal"))
9787      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
9788    if (json.has("coverage"))
9789      res.setCoverage(parseReference(getJObject(json, "coverage")));
9790    if (json.has("businessArrangement"))
9791      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
9792    if (json.has("_businessArrangement"))
9793      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
9794  }
9795
9796  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json,
9797      CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9798    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
9799    parseCoverageEligibilityRequestDetailsComponentProperties(json, owner, res);
9800    return res;
9801  }
9802
9803  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json,
9804      CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res)
9805      throws IOException, FHIRFormatError {
9806    parseBackboneElementProperties(json, res);
9807    if (json.has("supportingInfoSequence")) {
9808      JsonArray array = json.getAsJsonArray("supportingInfoSequence");
9809      for (int i = 0; i < array.size(); i++) {
9810        if (array.get(i).isJsonNull()) {
9811          res.getSupportingInfoSequence().add(new PositiveIntType());
9812        } else {
9813          res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
9814        }
9815      }
9816    }
9817    ;
9818    if (json.has("_supportingInfoSequence")) {
9819      JsonArray array = json.getAsJsonArray("_supportingInfoSequence");
9820      for (int i = 0; i < array.size(); i++) {
9821        if (i == res.getSupportingInfoSequence().size())
9822          res.getSupportingInfoSequence().add(parsePositiveInt(null));
9823        if (array.get(i) instanceof JsonObject)
9824          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
9825      }
9826    }
9827    ;
9828    if (json.has("category"))
9829      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9830    if (json.has("productOrService"))
9831      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
9832    if (json.has("modifier")) {
9833      JsonArray array = json.getAsJsonArray("modifier");
9834      for (int i = 0; i < array.size(); i++) {
9835        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9836      }
9837    }
9838    ;
9839    if (json.has("provider"))
9840      res.setProvider(parseReference(getJObject(json, "provider")));
9841    if (json.has("quantity"))
9842      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
9843    if (json.has("unitPrice"))
9844      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
9845    if (json.has("facility"))
9846      res.setFacility(parseReference(getJObject(json, "facility")));
9847    if (json.has("diagnosis")) {
9848      JsonArray array = json.getAsJsonArray("diagnosis");
9849      for (int i = 0; i < array.size(); i++) {
9850        res.getDiagnosis()
9851            .add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
9852      }
9853    }
9854    ;
9855    if (json.has("detail")) {
9856      JsonArray array = json.getAsJsonArray("detail");
9857      for (int i = 0; i < array.size(); i++) {
9858        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
9859      }
9860    }
9861    ;
9862  }
9863
9864  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(
9865      JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9866    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
9867    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, owner, res);
9868    return res;
9869  }
9870
9871  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json,
9872      CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res)
9873      throws IOException, FHIRFormatError {
9874    parseBackboneElementProperties(json, res);
9875    Type diagnosis = parseType("diagnosis", json);
9876    if (diagnosis != null)
9877      res.setDiagnosis(diagnosis);
9878  }
9879
9880  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json)
9881      throws IOException, FHIRFormatError {
9882    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
9883    parseCoverageEligibilityResponseProperties(json, res);
9884    return res;
9885  }
9886
9887  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res)
9888      throws IOException, FHIRFormatError {
9889    parseDomainResourceProperties(json, res);
9890    if (json.has("identifier")) {
9891      JsonArray array = json.getAsJsonArray("identifier");
9892      for (int i = 0; i < array.size(); i++) {
9893        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9894      }
9895    }
9896    ;
9897    if (json.has("status"))
9898      res.setStatusElement(
9899          parseEnumeration(json.get("status").getAsString(), CoverageEligibilityResponse.EligibilityResponseStatus.NULL,
9900              new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
9901    if (json.has("_status"))
9902      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9903    if (json.has("purpose")) {
9904      JsonArray array = json.getAsJsonArray("purpose");
9905      for (int i = 0; i < array.size(); i++) {
9906        if (array.get(i).isJsonNull()) {
9907          res.getPurpose().add(new Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose>());
9908        } else {
9909          res.getPurpose()
9910              .add(parseEnumeration(array.get(i).getAsString(),
9911                  CoverageEligibilityResponse.EligibilityResponsePurpose.NULL,
9912                  new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
9913        }
9914      }
9915    }
9916    ;
9917    if (json.has("_purpose")) {
9918      JsonArray array = json.getAsJsonArray("_purpose");
9919      for (int i = 0; i < array.size(); i++) {
9920        if (i == res.getPurpose().size())
9921          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL,
9922              new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
9923        if (array.get(i) instanceof JsonObject)
9924          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
9925      }
9926    }
9927    ;
9928    if (json.has("patient"))
9929      res.setPatient(parseReference(getJObject(json, "patient")));
9930    Type serviced = parseType("serviced", json);
9931    if (serviced != null)
9932      res.setServiced(serviced);
9933    if (json.has("created"))
9934      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9935    if (json.has("_created"))
9936      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
9937    if (json.has("requestor"))
9938      res.setRequestor(parseReference(getJObject(json, "requestor")));
9939    if (json.has("request"))
9940      res.setRequest(parseReference(getJObject(json, "request")));
9941    if (json.has("outcome"))
9942      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL,
9943          new Enumerations.RemittanceOutcomeEnumFactory()));
9944    if (json.has("_outcome"))
9945      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
9946    if (json.has("disposition"))
9947      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
9948    if (json.has("_disposition"))
9949      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
9950    if (json.has("insurer"))
9951      res.setInsurer(parseReference(getJObject(json, "insurer")));
9952    if (json.has("insurance")) {
9953      JsonArray array = json.getAsJsonArray("insurance");
9954      for (int i = 0; i < array.size(); i++) {
9955        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
9956      }
9957    }
9958    ;
9959    if (json.has("preAuthRef"))
9960      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
9961    if (json.has("_preAuthRef"))
9962      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
9963    if (json.has("form"))
9964      res.setForm(parseCodeableConcept(getJObject(json, "form")));
9965    if (json.has("error")) {
9966      JsonArray array = json.getAsJsonArray("error");
9967      for (int i = 0; i < array.size(); i++) {
9968        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
9969      }
9970    }
9971    ;
9972  }
9973
9974  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(
9975      JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
9976    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
9977    parseCoverageEligibilityResponseInsuranceComponentProperties(json, owner, res);
9978    return res;
9979  }
9980
9981  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json,
9982      CoverageEligibilityResponse owner, CoverageEligibilityResponse.InsuranceComponent res)
9983      throws IOException, FHIRFormatError {
9984    parseBackboneElementProperties(json, res);
9985    if (json.has("coverage"))
9986      res.setCoverage(parseReference(getJObject(json, "coverage")));
9987    if (json.has("inforce"))
9988      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
9989    if (json.has("_inforce"))
9990      parseElementProperties(getJObject(json, "_inforce"), res.getInforceElement());
9991    if (json.has("benefitPeriod"))
9992      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
9993    if (json.has("item")) {
9994      JsonArray array = json.getAsJsonArray("item");
9995      for (int i = 0; i < array.size(); i++) {
9996        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject(), owner));
9997      }
9998    }
9999    ;
10000  }
10001
10002  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json,
10003      CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
10004    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
10005    parseCoverageEligibilityResponseItemsComponentProperties(json, owner, res);
10006    return res;
10007  }
10008
10009  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json,
10010      CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent res)
10011      throws IOException, FHIRFormatError {
10012    parseBackboneElementProperties(json, res);
10013    if (json.has("category"))
10014      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
10015    if (json.has("productOrService"))
10016      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
10017    if (json.has("modifier")) {
10018      JsonArray array = json.getAsJsonArray("modifier");
10019      for (int i = 0; i < array.size(); i++) {
10020        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10021      }
10022    }
10023    ;
10024    if (json.has("provider"))
10025      res.setProvider(parseReference(getJObject(json, "provider")));
10026    if (json.has("excluded"))
10027      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
10028    if (json.has("_excluded"))
10029      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
10030    if (json.has("name"))
10031      res.setNameElement(parseString(json.get("name").getAsString()));
10032    if (json.has("_name"))
10033      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10034    if (json.has("description"))
10035      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10036    if (json.has("_description"))
10037      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10038    if (json.has("network"))
10039      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
10040    if (json.has("unit"))
10041      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
10042    if (json.has("term"))
10043      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
10044    if (json.has("benefit")) {
10045      JsonArray array = json.getAsJsonArray("benefit");
10046      for (int i = 0; i < array.size(); i++) {
10047        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
10048      }
10049    }
10050    ;
10051    if (json.has("authorizationRequired"))
10052      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
10053    if (json.has("_authorizationRequired"))
10054      parseElementProperties(getJObject(json, "_authorizationRequired"), res.getAuthorizationRequiredElement());
10055    if (json.has("authorizationSupporting")) {
10056      JsonArray array = json.getAsJsonArray("authorizationSupporting");
10057      for (int i = 0; i < array.size(); i++) {
10058        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10059      }
10060    }
10061    ;
10062    if (json.has("authorizationUrl"))
10063      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
10064    if (json.has("_authorizationUrl"))
10065      parseElementProperties(getJObject(json, "_authorizationUrl"), res.getAuthorizationUrlElement());
10066  }
10067
10068  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(
10069      JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
10070    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
10071    parseCoverageEligibilityResponseBenefitComponentProperties(json, owner, res);
10072    return res;
10073  }
10074
10075  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json,
10076      CoverageEligibilityResponse owner, CoverageEligibilityResponse.BenefitComponent res)
10077      throws IOException, FHIRFormatError {
10078    parseBackboneElementProperties(json, res);
10079    if (json.has("type"))
10080      res.setType(parseCodeableConcept(getJObject(json, "type")));
10081    Type allowed = parseType("allowed", json);
10082    if (allowed != null)
10083      res.setAllowed(allowed);
10084    Type used = parseType("used", json);
10085    if (used != null)
10086      res.setUsed(used);
10087  }
10088
10089  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json,
10090      CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
10091    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
10092    parseCoverageEligibilityResponseErrorsComponentProperties(json, owner, res);
10093    return res;
10094  }
10095
10096  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json,
10097      CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res)
10098      throws IOException, FHIRFormatError {
10099    parseBackboneElementProperties(json, res);
10100    if (json.has("code"))
10101      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10102  }
10103
10104  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
10105    DetectedIssue res = new DetectedIssue();
10106    parseDetectedIssueProperties(json, res);
10107    return res;
10108  }
10109
10110  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
10111    parseDomainResourceProperties(json, res);
10112    if (json.has("identifier")) {
10113      JsonArray array = json.getAsJsonArray("identifier");
10114      for (int i = 0; i < array.size(); i++) {
10115        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10116      }
10117    }
10118    ;
10119    if (json.has("status"))
10120      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL,
10121          new DetectedIssue.DetectedIssueStatusEnumFactory()));
10122    if (json.has("_status"))
10123      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10124    if (json.has("code"))
10125      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10126    if (json.has("severity"))
10127      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(),
10128          DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
10129    if (json.has("_severity"))
10130      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
10131    if (json.has("patient"))
10132      res.setPatient(parseReference(getJObject(json, "patient")));
10133    Type identified = parseType("identified", json);
10134    if (identified != null)
10135      res.setIdentified(identified);
10136    if (json.has("author"))
10137      res.setAuthor(parseReference(getJObject(json, "author")));
10138    if (json.has("implicated")) {
10139      JsonArray array = json.getAsJsonArray("implicated");
10140      for (int i = 0; i < array.size(); i++) {
10141        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
10142      }
10143    }
10144    ;
10145    if (json.has("evidence")) {
10146      JsonArray array = json.getAsJsonArray("evidence");
10147      for (int i = 0; i < array.size(); i++) {
10148        res.getEvidence().add(parseDetectedIssueDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject(), res));
10149      }
10150    }
10151    ;
10152    if (json.has("detail"))
10153      res.setDetailElement(parseString(json.get("detail").getAsString()));
10154    if (json.has("_detail"))
10155      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
10156    if (json.has("reference"))
10157      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
10158    if (json.has("_reference"))
10159      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
10160    if (json.has("mitigation")) {
10161      JsonArray array = json.getAsJsonArray("mitigation");
10162      for (int i = 0; i < array.size(); i++) {
10163        res.getMitigation()
10164            .add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
10165      }
10166    }
10167    ;
10168  }
10169
10170  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueDetectedIssueEvidenceComponent(
10171      JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
10172    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
10173    parseDetectedIssueDetectedIssueEvidenceComponentProperties(json, owner, res);
10174    return res;
10175  }
10176
10177  protected void parseDetectedIssueDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue owner,
10178      DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
10179    parseBackboneElementProperties(json, res);
10180    if (json.has("code")) {
10181      JsonArray array = json.getAsJsonArray("code");
10182      for (int i = 0; i < array.size(); i++) {
10183        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10184      }
10185    }
10186    ;
10187    if (json.has("detail")) {
10188      JsonArray array = json.getAsJsonArray("detail");
10189      for (int i = 0; i < array.size(); i++) {
10190        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
10191      }
10192    }
10193    ;
10194  }
10195
10196  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(
10197      JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
10198    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
10199    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
10200    return res;
10201  }
10202
10203  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner,
10204      DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
10205    parseBackboneElementProperties(json, res);
10206    if (json.has("action"))
10207      res.setAction(parseCodeableConcept(getJObject(json, "action")));
10208    if (json.has("date"))
10209      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10210    if (json.has("_date"))
10211      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10212    if (json.has("author"))
10213      res.setAuthor(parseReference(getJObject(json, "author")));
10214  }
10215
10216  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
10217    Device res = new Device();
10218    parseDeviceProperties(json, res);
10219    return res;
10220  }
10221
10222  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
10223    parseDomainResourceProperties(json, res);
10224    if (json.has("identifier")) {
10225      JsonArray array = json.getAsJsonArray("identifier");
10226      for (int i = 0; i < array.size(); i++) {
10227        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10228      }
10229    }
10230    ;
10231    if (json.has("definition"))
10232      res.setDefinition(parseReference(getJObject(json, "definition")));
10233    if (json.has("udiCarrier")) {
10234      JsonArray array = json.getAsJsonArray("udiCarrier");
10235      for (int i = 0; i < array.size(); i++) {
10236        res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(array.get(i).getAsJsonObject(), res));
10237      }
10238    }
10239    ;
10240    if (json.has("status"))
10241      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL,
10242          new Device.FHIRDeviceStatusEnumFactory()));
10243    if (json.has("_status"))
10244      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10245    if (json.has("statusReason")) {
10246      JsonArray array = json.getAsJsonArray("statusReason");
10247      for (int i = 0; i < array.size(); i++) {
10248        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10249      }
10250    }
10251    ;
10252    if (json.has("distinctIdentifier"))
10253      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
10254    if (json.has("_distinctIdentifier"))
10255      parseElementProperties(getJObject(json, "_distinctIdentifier"), res.getDistinctIdentifierElement());
10256    if (json.has("manufacturer"))
10257      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
10258    if (json.has("_manufacturer"))
10259      parseElementProperties(getJObject(json, "_manufacturer"), res.getManufacturerElement());
10260    if (json.has("manufactureDate"))
10261      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
10262    if (json.has("_manufactureDate"))
10263      parseElementProperties(getJObject(json, "_manufactureDate"), res.getManufactureDateElement());
10264    if (json.has("expirationDate"))
10265      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
10266    if (json.has("_expirationDate"))
10267      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
10268    if (json.has("lotNumber"))
10269      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
10270    if (json.has("_lotNumber"))
10271      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
10272    if (json.has("serialNumber"))
10273      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
10274    if (json.has("_serialNumber"))
10275      parseElementProperties(getJObject(json, "_serialNumber"), res.getSerialNumberElement());
10276    if (json.has("deviceName")) {
10277      JsonArray array = json.getAsJsonArray("deviceName");
10278      for (int i = 0; i < array.size(); i++) {
10279        res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(array.get(i).getAsJsonObject(), res));
10280      }
10281    }
10282    ;
10283    if (json.has("modelNumber"))
10284      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10285    if (json.has("_modelNumber"))
10286      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
10287    if (json.has("partNumber"))
10288      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
10289    if (json.has("_partNumber"))
10290      parseElementProperties(getJObject(json, "_partNumber"), res.getPartNumberElement());
10291    if (json.has("type"))
10292      res.setType(parseCodeableConcept(getJObject(json, "type")));
10293    if (json.has("specialization")) {
10294      JsonArray array = json.getAsJsonArray("specialization");
10295      for (int i = 0; i < array.size(); i++) {
10296        res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(array.get(i).getAsJsonObject(), res));
10297      }
10298    }
10299    ;
10300    if (json.has("version")) {
10301      JsonArray array = json.getAsJsonArray("version");
10302      for (int i = 0; i < array.size(); i++) {
10303        res.getVersion().add(parseDeviceDeviceVersionComponent(array.get(i).getAsJsonObject(), res));
10304      }
10305    }
10306    ;
10307    if (json.has("property")) {
10308      JsonArray array = json.getAsJsonArray("property");
10309      for (int i = 0; i < array.size(); i++) {
10310        res.getProperty().add(parseDeviceDevicePropertyComponent(array.get(i).getAsJsonObject(), res));
10311      }
10312    }
10313    ;
10314    if (json.has("patient"))
10315      res.setPatient(parseReference(getJObject(json, "patient")));
10316    if (json.has("owner"))
10317      res.setOwner(parseReference(getJObject(json, "owner")));
10318    if (json.has("contact")) {
10319      JsonArray array = json.getAsJsonArray("contact");
10320      for (int i = 0; i < array.size(); i++) {
10321        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10322      }
10323    }
10324    ;
10325    if (json.has("location"))
10326      res.setLocation(parseReference(getJObject(json, "location")));
10327    if (json.has("url"))
10328      res.setUrlElement(parseUri(json.get("url").getAsString()));
10329    if (json.has("_url"))
10330      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10331    if (json.has("note")) {
10332      JsonArray array = json.getAsJsonArray("note");
10333      for (int i = 0; i < array.size(); i++) {
10334        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10335      }
10336    }
10337    ;
10338    if (json.has("safety")) {
10339      JsonArray array = json.getAsJsonArray("safety");
10340      for (int i = 0; i < array.size(); i++) {
10341        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10342      }
10343    }
10344    ;
10345    if (json.has("parent"))
10346      res.setParent(parseReference(getJObject(json, "parent")));
10347  }
10348
10349  protected Device.DeviceUdiCarrierComponent parseDeviceDeviceUdiCarrierComponent(JsonObject json, Device owner)
10350      throws IOException, FHIRFormatError {
10351    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
10352    parseDeviceDeviceUdiCarrierComponentProperties(json, owner, res);
10353    return res;
10354  }
10355
10356  protected void parseDeviceDeviceUdiCarrierComponentProperties(JsonObject json, Device owner,
10357      Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
10358    parseBackboneElementProperties(json, res);
10359    if (json.has("deviceIdentifier"))
10360      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10361    if (json.has("_deviceIdentifier"))
10362      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
10363    if (json.has("issuer"))
10364      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10365    if (json.has("_issuer"))
10366      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
10367    if (json.has("jurisdiction"))
10368      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10369    if (json.has("_jurisdiction"))
10370      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
10371    if (json.has("carrierAIDC"))
10372      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
10373    if (json.has("_carrierAIDC"))
10374      parseElementProperties(getJObject(json, "_carrierAIDC"), res.getCarrierAIDCElement());
10375    if (json.has("carrierHRF"))
10376      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
10377    if (json.has("_carrierHRF"))
10378      parseElementProperties(getJObject(json, "_carrierHRF"), res.getCarrierHRFElement());
10379    if (json.has("entryType"))
10380      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL,
10381          new Device.UDIEntryTypeEnumFactory()));
10382    if (json.has("_entryType"))
10383      parseElementProperties(getJObject(json, "_entryType"), res.getEntryTypeElement());
10384  }
10385
10386  protected Device.DeviceDeviceNameComponent parseDeviceDeviceDeviceNameComponent(JsonObject json, Device owner)
10387      throws IOException, FHIRFormatError {
10388    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
10389    parseDeviceDeviceDeviceNameComponentProperties(json, owner, res);
10390    return res;
10391  }
10392
10393  protected void parseDeviceDeviceDeviceNameComponentProperties(JsonObject json, Device owner,
10394      Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
10395    parseBackboneElementProperties(json, res);
10396    if (json.has("name"))
10397      res.setNameElement(parseString(json.get("name").getAsString()));
10398    if (json.has("_name"))
10399      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10400    if (json.has("type"))
10401      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Device.DeviceNameType.NULL,
10402          new Device.DeviceNameTypeEnumFactory()));
10403    if (json.has("_type"))
10404      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10405  }
10406
10407  protected Device.DeviceSpecializationComponent parseDeviceDeviceSpecializationComponent(JsonObject json, Device owner)
10408      throws IOException, FHIRFormatError {
10409    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
10410    parseDeviceDeviceSpecializationComponentProperties(json, owner, res);
10411    return res;
10412  }
10413
10414  protected void parseDeviceDeviceSpecializationComponentProperties(JsonObject json, Device owner,
10415      Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
10416    parseBackboneElementProperties(json, res);
10417    if (json.has("systemType"))
10418      res.setSystemType(parseCodeableConcept(getJObject(json, "systemType")));
10419    if (json.has("version"))
10420      res.setVersionElement(parseString(json.get("version").getAsString()));
10421    if (json.has("_version"))
10422      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10423  }
10424
10425  protected Device.DeviceVersionComponent parseDeviceDeviceVersionComponent(JsonObject json, Device owner)
10426      throws IOException, FHIRFormatError {
10427    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
10428    parseDeviceDeviceVersionComponentProperties(json, owner, res);
10429    return res;
10430  }
10431
10432  protected void parseDeviceDeviceVersionComponentProperties(JsonObject json, Device owner,
10433      Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
10434    parseBackboneElementProperties(json, res);
10435    if (json.has("type"))
10436      res.setType(parseCodeableConcept(getJObject(json, "type")));
10437    if (json.has("component"))
10438      res.setComponent(parseIdentifier(getJObject(json, "component")));
10439    if (json.has("value"))
10440      res.setValueElement(parseString(json.get("value").getAsString()));
10441    if (json.has("_value"))
10442      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
10443  }
10444
10445  protected Device.DevicePropertyComponent parseDeviceDevicePropertyComponent(JsonObject json, Device owner)
10446      throws IOException, FHIRFormatError {
10447    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
10448    parseDeviceDevicePropertyComponentProperties(json, owner, res);
10449    return res;
10450  }
10451
10452  protected void parseDeviceDevicePropertyComponentProperties(JsonObject json, Device owner,
10453      Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
10454    parseBackboneElementProperties(json, res);
10455    if (json.has("type"))
10456      res.setType(parseCodeableConcept(getJObject(json, "type")));
10457    if (json.has("valueQuantity")) {
10458      JsonArray array = json.getAsJsonArray("valueQuantity");
10459      for (int i = 0; i < array.size(); i++) {
10460        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10461      }
10462    }
10463    ;
10464    if (json.has("valueCode")) {
10465      JsonArray array = json.getAsJsonArray("valueCode");
10466      for (int i = 0; i < array.size(); i++) {
10467        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10468      }
10469    }
10470    ;
10471  }
10472
10473  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
10474    DeviceDefinition res = new DeviceDefinition();
10475    parseDeviceDefinitionProperties(json, res);
10476    return res;
10477  }
10478
10479  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res)
10480      throws IOException, FHIRFormatError {
10481    parseDomainResourceProperties(json, res);
10482    if (json.has("identifier")) {
10483      JsonArray array = json.getAsJsonArray("identifier");
10484      for (int i = 0; i < array.size(); i++) {
10485        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10486      }
10487    }
10488    ;
10489    if (json.has("udiDeviceIdentifier")) {
10490      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
10491      for (int i = 0; i < array.size(); i++) {
10492        res.getUdiDeviceIdentifier().add(
10493            parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject(), res));
10494      }
10495    }
10496    ;
10497    Type manufacturer = parseType("manufacturer", json);
10498    if (manufacturer != null)
10499      res.setManufacturer(manufacturer);
10500    if (json.has("deviceName")) {
10501      JsonArray array = json.getAsJsonArray("deviceName");
10502      for (int i = 0; i < array.size(); i++) {
10503        res.getDeviceName()
10504            .add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject(), res));
10505      }
10506    }
10507    ;
10508    if (json.has("modelNumber"))
10509      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10510    if (json.has("_modelNumber"))
10511      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
10512    if (json.has("type"))
10513      res.setType(parseCodeableConcept(getJObject(json, "type")));
10514    if (json.has("specialization")) {
10515      JsonArray array = json.getAsJsonArray("specialization");
10516      for (int i = 0; i < array.size(); i++) {
10517        res.getSpecialization()
10518            .add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject(), res));
10519      }
10520    }
10521    ;
10522    if (json.has("version")) {
10523      JsonArray array = json.getAsJsonArray("version");
10524      for (int i = 0; i < array.size(); i++) {
10525        if (array.get(i).isJsonNull()) {
10526          res.getVersion().add(new StringType());
10527        } else {
10528          res.getVersion().add(parseString(array.get(i).getAsString()));
10529        }
10530      }
10531    }
10532    ;
10533    if (json.has("_version")) {
10534      JsonArray array = json.getAsJsonArray("_version");
10535      for (int i = 0; i < array.size(); i++) {
10536        if (i == res.getVersion().size())
10537          res.getVersion().add(parseString(null));
10538        if (array.get(i) instanceof JsonObject)
10539          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
10540      }
10541    }
10542    ;
10543    if (json.has("safety")) {
10544      JsonArray array = json.getAsJsonArray("safety");
10545      for (int i = 0; i < array.size(); i++) {
10546        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10547      }
10548    }
10549    ;
10550    if (json.has("shelfLifeStorage")) {
10551      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
10552      for (int i = 0; i < array.size(); i++) {
10553        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
10554      }
10555    }
10556    ;
10557    if (json.has("physicalCharacteristics"))
10558      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
10559    if (json.has("languageCode")) {
10560      JsonArray array = json.getAsJsonArray("languageCode");
10561      for (int i = 0; i < array.size(); i++) {
10562        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10563      }
10564    }
10565    ;
10566    if (json.has("capability")) {
10567      JsonArray array = json.getAsJsonArray("capability");
10568      for (int i = 0; i < array.size(); i++) {
10569        res.getCapability()
10570            .add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject(), res));
10571      }
10572    }
10573    ;
10574    if (json.has("property")) {
10575      JsonArray array = json.getAsJsonArray("property");
10576      for (int i = 0; i < array.size(); i++) {
10577        res.getProperty()
10578            .add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
10579      }
10580    }
10581    ;
10582    if (json.has("owner"))
10583      res.setOwner(parseReference(getJObject(json, "owner")));
10584    if (json.has("contact")) {
10585      JsonArray array = json.getAsJsonArray("contact");
10586      for (int i = 0; i < array.size(); i++) {
10587        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10588      }
10589    }
10590    ;
10591    if (json.has("url"))
10592      res.setUrlElement(parseUri(json.get("url").getAsString()));
10593    if (json.has("_url"))
10594      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10595    if (json.has("onlineInformation"))
10596      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
10597    if (json.has("_onlineInformation"))
10598      parseElementProperties(getJObject(json, "_onlineInformation"), res.getOnlineInformationElement());
10599    if (json.has("note")) {
10600      JsonArray array = json.getAsJsonArray("note");
10601      for (int i = 0; i < array.size(); i++) {
10602        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10603      }
10604    }
10605    ;
10606    if (json.has("quantity"))
10607      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
10608    if (json.has("parentDevice"))
10609      res.setParentDevice(parseReference(getJObject(json, "parentDevice")));
10610    if (json.has("material")) {
10611      JsonArray array = json.getAsJsonArray("material");
10612      for (int i = 0; i < array.size(); i++) {
10613        res.getMaterial()
10614            .add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject(), res));
10615      }
10616    }
10617    ;
10618  }
10619
10620  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(
10621      JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10622    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
10623    parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, owner, res);
10624    return res;
10625  }
10626
10627  protected void parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json,
10628      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res)
10629      throws IOException, FHIRFormatError {
10630    parseBackboneElementProperties(json, res);
10631    if (json.has("deviceIdentifier"))
10632      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10633    if (json.has("_deviceIdentifier"))
10634      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
10635    if (json.has("issuer"))
10636      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10637    if (json.has("_issuer"))
10638      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
10639    if (json.has("jurisdiction"))
10640      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10641    if (json.has("_jurisdiction"))
10642      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
10643  }
10644
10645  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(
10646      JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10647    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
10648    parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(json, owner, res);
10649    return res;
10650  }
10651
10652  protected void parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(JsonObject json,
10653      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent res)
10654      throws IOException, FHIRFormatError {
10655    parseBackboneElementProperties(json, res);
10656    if (json.has("name"))
10657      res.setNameElement(parseString(json.get("name").getAsString()));
10658    if (json.has("_name"))
10659      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10660    if (json.has("type"))
10661      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceNameType.NULL,
10662          new DeviceDefinition.DeviceNameTypeEnumFactory()));
10663    if (json.has("_type"))
10664      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10665  }
10666
10667  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(
10668      JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10669    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
10670    parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(json, owner, res);
10671    return res;
10672  }
10673
10674  protected void parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(JsonObject json,
10675      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res)
10676      throws IOException, FHIRFormatError {
10677    parseBackboneElementProperties(json, res);
10678    if (json.has("systemType"))
10679      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
10680    if (json.has("_systemType"))
10681      parseElementProperties(getJObject(json, "_systemType"), res.getSystemTypeElement());
10682    if (json.has("version"))
10683      res.setVersionElement(parseString(json.get("version").getAsString()));
10684    if (json.has("_version"))
10685      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10686  }
10687
10688  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(
10689      JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10690    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
10691    parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(json, owner, res);
10692    return res;
10693  }
10694
10695  protected void parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(JsonObject json,
10696      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent res)
10697      throws IOException, FHIRFormatError {
10698    parseBackboneElementProperties(json, res);
10699    if (json.has("type"))
10700      res.setType(parseCodeableConcept(getJObject(json, "type")));
10701    if (json.has("description")) {
10702      JsonArray array = json.getAsJsonArray("description");
10703      for (int i = 0; i < array.size(); i++) {
10704        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10705      }
10706    }
10707    ;
10708  }
10709
10710  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(
10711      JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10712    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
10713    parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(json, owner, res);
10714    return res;
10715  }
10716
10717  protected void parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(JsonObject json,
10718      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent res)
10719      throws IOException, FHIRFormatError {
10720    parseBackboneElementProperties(json, res);
10721    if (json.has("type"))
10722      res.setType(parseCodeableConcept(getJObject(json, "type")));
10723    if (json.has("valueQuantity")) {
10724      JsonArray array = json.getAsJsonArray("valueQuantity");
10725      for (int i = 0; i < array.size(); i++) {
10726        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10727      }
10728    }
10729    ;
10730    if (json.has("valueCode")) {
10731      JsonArray array = json.getAsJsonArray("valueCode");
10732      for (int i = 0; i < array.size(); i++) {
10733        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10734      }
10735    }
10736    ;
10737  }
10738
10739  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(
10740      JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10741    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
10742    parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(json, owner, res);
10743    return res;
10744  }
10745
10746  protected void parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(JsonObject json,
10747      DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent res)
10748      throws IOException, FHIRFormatError {
10749    parseBackboneElementProperties(json, res);
10750    if (json.has("substance"))
10751      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
10752    if (json.has("alternate"))
10753      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
10754    if (json.has("_alternate"))
10755      parseElementProperties(getJObject(json, "_alternate"), res.getAlternateElement());
10756    if (json.has("allergenicIndicator"))
10757      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
10758    if (json.has("_allergenicIndicator"))
10759      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
10760  }
10761
10762  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
10763    DeviceMetric res = new DeviceMetric();
10764    parseDeviceMetricProperties(json, res);
10765    return res;
10766  }
10767
10768  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
10769    parseDomainResourceProperties(json, res);
10770    if (json.has("identifier")) {
10771      JsonArray array = json.getAsJsonArray("identifier");
10772      for (int i = 0; i < array.size(); i++) {
10773        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10774      }
10775    }
10776    ;
10777    if (json.has("type"))
10778      res.setType(parseCodeableConcept(getJObject(json, "type")));
10779    if (json.has("unit"))
10780      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
10781    if (json.has("source"))
10782      res.setSource(parseReference(getJObject(json, "source")));
10783    if (json.has("parent"))
10784      res.setParent(parseReference(getJObject(json, "parent")));
10785    if (json.has("operationalStatus"))
10786      res.setOperationalStatusElement(
10787          parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL,
10788              new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
10789    if (json.has("_operationalStatus"))
10790      parseElementProperties(getJObject(json, "_operationalStatus"), res.getOperationalStatusElement());
10791    if (json.has("color"))
10792      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL,
10793          new DeviceMetric.DeviceMetricColorEnumFactory()));
10794    if (json.has("_color"))
10795      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
10796    if (json.has("category"))
10797      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(),
10798          DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
10799    if (json.has("_category"))
10800      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
10801    if (json.has("measurementPeriod"))
10802      res.setMeasurementPeriod(parseTiming(getJObject(json, "measurementPeriod")));
10803    if (json.has("calibration")) {
10804      JsonArray array = json.getAsJsonArray("calibration");
10805      for (int i = 0; i < array.size(); i++) {
10806        res.getCalibration()
10807            .add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
10808      }
10809    }
10810    ;
10811  }
10812
10813  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(
10814      JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
10815    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
10816    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
10817    return res;
10818  }
10819
10820  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner,
10821      DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
10822    parseBackboneElementProperties(json, res);
10823    if (json.has("type"))
10824      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL,
10825          new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
10826    if (json.has("_type"))
10827      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10828    if (json.has("state"))
10829      res.setStateElement(parseEnumeration(json.get("state").getAsString(),
10830          DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
10831    if (json.has("_state"))
10832      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
10833    if (json.has("time"))
10834      res.setTimeElement(parseInstant(json.get("time").getAsString()));
10835    if (json.has("_time"))
10836      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
10837  }
10838
10839  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
10840    DeviceRequest res = new DeviceRequest();
10841    parseDeviceRequestProperties(json, res);
10842    return res;
10843  }
10844
10845  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
10846    parseDomainResourceProperties(json, res);
10847    if (json.has("identifier")) {
10848      JsonArray array = json.getAsJsonArray("identifier");
10849      for (int i = 0; i < array.size(); i++) {
10850        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10851      }
10852    }
10853    ;
10854    if (json.has("instantiatesCanonical")) {
10855      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
10856      for (int i = 0; i < array.size(); i++) {
10857        if (array.get(i).isJsonNull()) {
10858          res.getInstantiatesCanonical().add(new CanonicalType());
10859        } else {
10860          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
10861        }
10862      }
10863    }
10864    ;
10865    if (json.has("_instantiatesCanonical")) {
10866      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
10867      for (int i = 0; i < array.size(); i++) {
10868        if (i == res.getInstantiatesCanonical().size())
10869          res.getInstantiatesCanonical().add(parseCanonical(null));
10870        if (array.get(i) instanceof JsonObject)
10871          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
10872      }
10873    }
10874    ;
10875    if (json.has("instantiatesUri")) {
10876      JsonArray array = json.getAsJsonArray("instantiatesUri");
10877      for (int i = 0; i < array.size(); i++) {
10878        if (array.get(i).isJsonNull()) {
10879          res.getInstantiatesUri().add(new UriType());
10880        } else {
10881          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
10882        }
10883      }
10884    }
10885    ;
10886    if (json.has("_instantiatesUri")) {
10887      JsonArray array = json.getAsJsonArray("_instantiatesUri");
10888      for (int i = 0; i < array.size(); i++) {
10889        if (i == res.getInstantiatesUri().size())
10890          res.getInstantiatesUri().add(parseUri(null));
10891        if (array.get(i) instanceof JsonObject)
10892          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
10893      }
10894    }
10895    ;
10896    if (json.has("basedOn")) {
10897      JsonArray array = json.getAsJsonArray("basedOn");
10898      for (int i = 0; i < array.size(); i++) {
10899        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10900      }
10901    }
10902    ;
10903    if (json.has("priorRequest")) {
10904      JsonArray array = json.getAsJsonArray("priorRequest");
10905      for (int i = 0; i < array.size(); i++) {
10906        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
10907      }
10908    }
10909    ;
10910    if (json.has("groupIdentifier"))
10911      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
10912    if (json.has("status"))
10913      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL,
10914          new DeviceRequest.DeviceRequestStatusEnumFactory()));
10915    if (json.has("_status"))
10916      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10917    if (json.has("intent"))
10918      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), DeviceRequest.RequestIntent.NULL,
10919          new DeviceRequest.RequestIntentEnumFactory()));
10920    if (json.has("_intent"))
10921      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
10922    if (json.has("priority"))
10923      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL,
10924          new DeviceRequest.RequestPriorityEnumFactory()));
10925    if (json.has("_priority"))
10926      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
10927    Type code = parseType("code", json);
10928    if (code != null)
10929      res.setCode(code);
10930    if (json.has("parameter")) {
10931      JsonArray array = json.getAsJsonArray("parameter");
10932      for (int i = 0; i < array.size(); i++) {
10933        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
10934      }
10935    }
10936    ;
10937    if (json.has("subject"))
10938      res.setSubject(parseReference(getJObject(json, "subject")));
10939    if (json.has("encounter"))
10940      res.setEncounter(parseReference(getJObject(json, "encounter")));
10941    Type occurrence = parseType("occurrence", json);
10942    if (occurrence != null)
10943      res.setOccurrence(occurrence);
10944    if (json.has("authoredOn"))
10945      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
10946    if (json.has("_authoredOn"))
10947      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
10948    if (json.has("requester"))
10949      res.setRequester(parseReference(getJObject(json, "requester")));
10950    if (json.has("performerType"))
10951      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
10952    if (json.has("performer"))
10953      res.setPerformer(parseReference(getJObject(json, "performer")));
10954    if (json.has("reasonCode")) {
10955      JsonArray array = json.getAsJsonArray("reasonCode");
10956      for (int i = 0; i < array.size(); i++) {
10957        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10958      }
10959    }
10960    ;
10961    if (json.has("reasonReference")) {
10962      JsonArray array = json.getAsJsonArray("reasonReference");
10963      for (int i = 0; i < array.size(); i++) {
10964        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10965      }
10966    }
10967    ;
10968    if (json.has("insurance")) {
10969      JsonArray array = json.getAsJsonArray("insurance");
10970      for (int i = 0; i < array.size(); i++) {
10971        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
10972      }
10973    }
10974    ;
10975    if (json.has("supportingInfo")) {
10976      JsonArray array = json.getAsJsonArray("supportingInfo");
10977      for (int i = 0; i < array.size(); i++) {
10978        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
10979      }
10980    }
10981    ;
10982    if (json.has("note")) {
10983      JsonArray array = json.getAsJsonArray("note");
10984      for (int i = 0; i < array.size(); i++) {
10985        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10986      }
10987    }
10988    ;
10989    if (json.has("relevantHistory")) {
10990      JsonArray array = json.getAsJsonArray("relevantHistory");
10991      for (int i = 0; i < array.size(); i++) {
10992        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
10993      }
10994    }
10995    ;
10996  }
10997
10998  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(
10999      JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
11000    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
11001    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
11002    return res;
11003  }
11004
11005  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner,
11006      DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
11007    parseBackboneElementProperties(json, res);
11008    if (json.has("code"))
11009      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11010    Type value = parseType("value", json);
11011    if (value != null)
11012      res.setValue(value);
11013  }
11014
11015  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
11016    DeviceUseStatement res = new DeviceUseStatement();
11017    parseDeviceUseStatementProperties(json, res);
11018    return res;
11019  }
11020
11021  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res)
11022      throws IOException, FHIRFormatError {
11023    parseDomainResourceProperties(json, res);
11024    if (json.has("identifier")) {
11025      JsonArray array = json.getAsJsonArray("identifier");
11026      for (int i = 0; i < array.size(); i++) {
11027        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11028      }
11029    }
11030    ;
11031    if (json.has("basedOn")) {
11032      JsonArray array = json.getAsJsonArray("basedOn");
11033      for (int i = 0; i < array.size(); i++) {
11034        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11035      }
11036    }
11037    ;
11038    if (json.has("status"))
11039      res.setStatusElement(
11040          parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL,
11041              new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
11042    if (json.has("_status"))
11043      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11044    if (json.has("subject"))
11045      res.setSubject(parseReference(getJObject(json, "subject")));
11046    if (json.has("derivedFrom")) {
11047      JsonArray array = json.getAsJsonArray("derivedFrom");
11048      for (int i = 0; i < array.size(); i++) {
11049        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
11050      }
11051    }
11052    ;
11053    Type timing = parseType("timing", json);
11054    if (timing != null)
11055      res.setTiming(timing);
11056    if (json.has("recordedOn"))
11057      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
11058    if (json.has("_recordedOn"))
11059      parseElementProperties(getJObject(json, "_recordedOn"), res.getRecordedOnElement());
11060    if (json.has("source"))
11061      res.setSource(parseReference(getJObject(json, "source")));
11062    if (json.has("device"))
11063      res.setDevice(parseReference(getJObject(json, "device")));
11064    if (json.has("reasonCode")) {
11065      JsonArray array = json.getAsJsonArray("reasonCode");
11066      for (int i = 0; i < array.size(); i++) {
11067        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11068      }
11069    }
11070    ;
11071    if (json.has("reasonReference")) {
11072      JsonArray array = json.getAsJsonArray("reasonReference");
11073      for (int i = 0; i < array.size(); i++) {
11074        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11075      }
11076    }
11077    ;
11078    if (json.has("bodySite"))
11079      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
11080    if (json.has("note")) {
11081      JsonArray array = json.getAsJsonArray("note");
11082      for (int i = 0; i < array.size(); i++) {
11083        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11084      }
11085    }
11086    ;
11087  }
11088
11089  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
11090    DiagnosticReport res = new DiagnosticReport();
11091    parseDiagnosticReportProperties(json, res);
11092    return res;
11093  }
11094
11095  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res)
11096      throws IOException, FHIRFormatError {
11097    parseDomainResourceProperties(json, res);
11098    if (json.has("identifier")) {
11099      JsonArray array = json.getAsJsonArray("identifier");
11100      for (int i = 0; i < array.size(); i++) {
11101        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11102      }
11103    }
11104    ;
11105    if (json.has("basedOn")) {
11106      JsonArray array = json.getAsJsonArray("basedOn");
11107      for (int i = 0; i < array.size(); i++) {
11108        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11109      }
11110    }
11111    ;
11112    if (json.has("status"))
11113      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
11114          DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
11115    if (json.has("_status"))
11116      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11117    if (json.has("category")) {
11118      JsonArray array = json.getAsJsonArray("category");
11119      for (int i = 0; i < array.size(); i++) {
11120        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11121      }
11122    }
11123    ;
11124    if (json.has("code"))
11125      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11126    if (json.has("subject"))
11127      res.setSubject(parseReference(getJObject(json, "subject")));
11128    if (json.has("encounter"))
11129      res.setEncounter(parseReference(getJObject(json, "encounter")));
11130    Type effective = parseType("effective", json);
11131    if (effective != null)
11132      res.setEffective(effective);
11133    if (json.has("issued"))
11134      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
11135    if (json.has("_issued"))
11136      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
11137    if (json.has("performer")) {
11138      JsonArray array = json.getAsJsonArray("performer");
11139      for (int i = 0; i < array.size(); i++) {
11140        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
11141      }
11142    }
11143    ;
11144    if (json.has("resultsInterpreter")) {
11145      JsonArray array = json.getAsJsonArray("resultsInterpreter");
11146      for (int i = 0; i < array.size(); i++) {
11147        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
11148      }
11149    }
11150    ;
11151    if (json.has("specimen")) {
11152      JsonArray array = json.getAsJsonArray("specimen");
11153      for (int i = 0; i < array.size(); i++) {
11154        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
11155      }
11156    }
11157    ;
11158    if (json.has("result")) {
11159      JsonArray array = json.getAsJsonArray("result");
11160      for (int i = 0; i < array.size(); i++) {
11161        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
11162      }
11163    }
11164    ;
11165    if (json.has("imagingStudy")) {
11166      JsonArray array = json.getAsJsonArray("imagingStudy");
11167      for (int i = 0; i < array.size(); i++) {
11168        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
11169      }
11170    }
11171    ;
11172    if (json.has("media")) {
11173      JsonArray array = json.getAsJsonArray("media");
11174      for (int i = 0; i < array.size(); i++) {
11175        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
11176      }
11177    }
11178    ;
11179    if (json.has("conclusion"))
11180      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
11181    if (json.has("_conclusion"))
11182      parseElementProperties(getJObject(json, "_conclusion"), res.getConclusionElement());
11183    if (json.has("conclusionCode")) {
11184      JsonArray array = json.getAsJsonArray("conclusionCode");
11185      for (int i = 0; i < array.size(); i++) {
11186        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11187      }
11188    }
11189    ;
11190    if (json.has("presentedForm")) {
11191      JsonArray array = json.getAsJsonArray("presentedForm");
11192      for (int i = 0; i < array.size(); i++) {
11193        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
11194      }
11195    }
11196    ;
11197  }
11198
11199  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(
11200      JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
11201    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
11202    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
11203    return res;
11204  }
11205
11206  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner,
11207      DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
11208    parseBackboneElementProperties(json, res);
11209    if (json.has("comment"))
11210      res.setCommentElement(parseString(json.get("comment").getAsString()));
11211    if (json.has("_comment"))
11212      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
11213    if (json.has("link"))
11214      res.setLink(parseReference(getJObject(json, "link")));
11215  }
11216
11217  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
11218    DocumentManifest res = new DocumentManifest();
11219    parseDocumentManifestProperties(json, res);
11220    return res;
11221  }
11222
11223  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res)
11224      throws IOException, FHIRFormatError {
11225    parseDomainResourceProperties(json, res);
11226    if (json.has("masterIdentifier"))
11227      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
11228    if (json.has("identifier")) {
11229      JsonArray array = json.getAsJsonArray("identifier");
11230      for (int i = 0; i < array.size(); i++) {
11231        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11232      }
11233    }
11234    ;
11235    if (json.has("status"))
11236      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL,
11237          new Enumerations.DocumentReferenceStatusEnumFactory()));
11238    if (json.has("_status"))
11239      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11240    if (json.has("type"))
11241      res.setType(parseCodeableConcept(getJObject(json, "type")));
11242    if (json.has("subject"))
11243      res.setSubject(parseReference(getJObject(json, "subject")));
11244    if (json.has("created"))
11245      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11246    if (json.has("_created"))
11247      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11248    if (json.has("author")) {
11249      JsonArray array = json.getAsJsonArray("author");
11250      for (int i = 0; i < array.size(); i++) {
11251        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
11252      }
11253    }
11254    ;
11255    if (json.has("recipient")) {
11256      JsonArray array = json.getAsJsonArray("recipient");
11257      for (int i = 0; i < array.size(); i++) {
11258        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
11259      }
11260    }
11261    ;
11262    if (json.has("source"))
11263      res.setSourceElement(parseUri(json.get("source").getAsString()));
11264    if (json.has("_source"))
11265      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
11266    if (json.has("description"))
11267      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11268    if (json.has("_description"))
11269      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11270    if (json.has("content")) {
11271      JsonArray array = json.getAsJsonArray("content");
11272      for (int i = 0; i < array.size(); i++) {
11273        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
11274      }
11275    }
11276    ;
11277    if (json.has("related")) {
11278      JsonArray array = json.getAsJsonArray("related");
11279      for (int i = 0; i < array.size(); i++) {
11280        res.getRelated()
11281            .add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
11282      }
11283    }
11284    ;
11285  }
11286
11287  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(
11288      JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
11289    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
11290    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
11291    return res;
11292  }
11293
11294  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json,
11295      DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res)
11296      throws IOException, FHIRFormatError {
11297    parseBackboneElementProperties(json, res);
11298    if (json.has("identifier"))
11299      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11300    if (json.has("ref"))
11301      res.setRef(parseReference(getJObject(json, "ref")));
11302  }
11303
11304  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
11305    DocumentReference res = new DocumentReference();
11306    parseDocumentReferenceProperties(json, res);
11307    return res;
11308  }
11309
11310  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res)
11311      throws IOException, FHIRFormatError {
11312    parseDomainResourceProperties(json, res);
11313    if (json.has("masterIdentifier"))
11314      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
11315    if (json.has("identifier")) {
11316      JsonArray array = json.getAsJsonArray("identifier");
11317      for (int i = 0; i < array.size(); i++) {
11318        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11319      }
11320    }
11321    ;
11322    if (json.has("status"))
11323      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL,
11324          new Enumerations.DocumentReferenceStatusEnumFactory()));
11325    if (json.has("_status"))
11326      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11327    if (json.has("docStatus"))
11328      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(),
11329          DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
11330    if (json.has("_docStatus"))
11331      parseElementProperties(getJObject(json, "_docStatus"), res.getDocStatusElement());
11332    if (json.has("type"))
11333      res.setType(parseCodeableConcept(getJObject(json, "type")));
11334    if (json.has("category")) {
11335      JsonArray array = json.getAsJsonArray("category");
11336      for (int i = 0; i < array.size(); i++) {
11337        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11338      }
11339    }
11340    ;
11341    if (json.has("subject"))
11342      res.setSubject(parseReference(getJObject(json, "subject")));
11343    if (json.has("date"))
11344      res.setDateElement(parseInstant(json.get("date").getAsString()));
11345    if (json.has("_date"))
11346      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11347    if (json.has("author")) {
11348      JsonArray array = json.getAsJsonArray("author");
11349      for (int i = 0; i < array.size(); i++) {
11350        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
11351      }
11352    }
11353    ;
11354    if (json.has("authenticator"))
11355      res.setAuthenticator(parseReference(getJObject(json, "authenticator")));
11356    if (json.has("custodian"))
11357      res.setCustodian(parseReference(getJObject(json, "custodian")));
11358    if (json.has("relatesTo")) {
11359      JsonArray array = json.getAsJsonArray("relatesTo");
11360      for (int i = 0; i < array.size(); i++) {
11361        res.getRelatesTo()
11362            .add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
11363      }
11364    }
11365    ;
11366    if (json.has("description"))
11367      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11368    if (json.has("_description"))
11369      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11370    if (json.has("securityLabel")) {
11371      JsonArray array = json.getAsJsonArray("securityLabel");
11372      for (int i = 0; i < array.size(); i++) {
11373        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11374      }
11375    }
11376    ;
11377    if (json.has("content")) {
11378      JsonArray array = json.getAsJsonArray("content");
11379      for (int i = 0; i < array.size(); i++) {
11380        res.getContent()
11381            .add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
11382      }
11383    }
11384    ;
11385    if (json.has("context"))
11386      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(getJObject(json, "context"), res));
11387  }
11388
11389  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(
11390      JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
11391    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
11392    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
11393    return res;
11394  }
11395
11396  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json,
11397      DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res)
11398      throws IOException, FHIRFormatError {
11399    parseBackboneElementProperties(json, res);
11400    if (json.has("code"))
11401      res.setCodeElement(
11402          parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL,
11403              new DocumentReference.DocumentRelationshipTypeEnumFactory()));
11404    if (json.has("_code"))
11405      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
11406    if (json.has("target"))
11407      res.setTarget(parseReference(getJObject(json, "target")));
11408  }
11409
11410  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(
11411      JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
11412    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
11413    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
11414    return res;
11415  }
11416
11417  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json,
11418      DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res)
11419      throws IOException, FHIRFormatError {
11420    parseBackboneElementProperties(json, res);
11421    if (json.has("attachment"))
11422      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
11423    if (json.has("format"))
11424      res.setFormat(parseCoding(getJObject(json, "format")));
11425  }
11426
11427  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(
11428      JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
11429    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
11430    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
11431    return res;
11432  }
11433
11434  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json,
11435      DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res)
11436      throws IOException, FHIRFormatError {
11437    parseBackboneElementProperties(json, res);
11438    if (json.has("encounter")) {
11439      JsonArray array = json.getAsJsonArray("encounter");
11440      for (int i = 0; i < array.size(); i++) {
11441        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
11442      }
11443    }
11444    ;
11445    if (json.has("event")) {
11446      JsonArray array = json.getAsJsonArray("event");
11447      for (int i = 0; i < array.size(); i++) {
11448        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11449      }
11450    }
11451    ;
11452    if (json.has("period"))
11453      res.setPeriod(parsePeriod(getJObject(json, "period")));
11454    if (json.has("facilityType"))
11455      res.setFacilityType(parseCodeableConcept(getJObject(json, "facilityType")));
11456    if (json.has("practiceSetting"))
11457      res.setPracticeSetting(parseCodeableConcept(getJObject(json, "practiceSetting")));
11458    if (json.has("sourcePatientInfo"))
11459      res.setSourcePatientInfo(parseReference(getJObject(json, "sourcePatientInfo")));
11460    if (json.has("related")) {
11461      JsonArray array = json.getAsJsonArray("related");
11462      for (int i = 0; i < array.size(); i++) {
11463        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
11464      }
11465    }
11466    ;
11467  }
11468
11469  protected EffectEvidenceSynthesis parseEffectEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
11470    EffectEvidenceSynthesis res = new EffectEvidenceSynthesis();
11471    parseEffectEvidenceSynthesisProperties(json, res);
11472    return res;
11473  }
11474
11475  protected void parseEffectEvidenceSynthesisProperties(JsonObject json, EffectEvidenceSynthesis res)
11476      throws IOException, FHIRFormatError {
11477    parseDomainResourceProperties(json, res);
11478    if (json.has("url"))
11479      res.setUrlElement(parseUri(json.get("url").getAsString()));
11480    if (json.has("_url"))
11481      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
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    ;
11489    if (json.has("version"))
11490      res.setVersionElement(parseString(json.get("version").getAsString()));
11491    if (json.has("_version"))
11492      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11493    if (json.has("name"))
11494      res.setNameElement(parseString(json.get("name").getAsString()));
11495    if (json.has("_name"))
11496      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11497    if (json.has("title"))
11498      res.setTitleElement(parseString(json.get("title").getAsString()));
11499    if (json.has("_title"))
11500      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11501    if (json.has("status"))
11502      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
11503          new Enumerations.PublicationStatusEnumFactory()));
11504    if (json.has("_status"))
11505      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
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("publisher"))
11511      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11512    if (json.has("_publisher"))
11513      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11514    if (json.has("contact")) {
11515      JsonArray array = json.getAsJsonArray("contact");
11516      for (int i = 0; i < array.size(); i++) {
11517        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11518      }
11519    }
11520    ;
11521    if (json.has("description"))
11522      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11523    if (json.has("_description"))
11524      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11525    if (json.has("note")) {
11526      JsonArray array = json.getAsJsonArray("note");
11527      for (int i = 0; i < array.size(); i++) {
11528        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11529      }
11530    }
11531    ;
11532    if (json.has("useContext")) {
11533      JsonArray array = json.getAsJsonArray("useContext");
11534      for (int i = 0; i < array.size(); i++) {
11535        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11536      }
11537    }
11538    ;
11539    if (json.has("jurisdiction")) {
11540      JsonArray array = json.getAsJsonArray("jurisdiction");
11541      for (int i = 0; i < array.size(); i++) {
11542        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11543      }
11544    }
11545    ;
11546    if (json.has("copyright"))
11547      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11548    if (json.has("_copyright"))
11549      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11550    if (json.has("approvalDate"))
11551      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11552    if (json.has("_approvalDate"))
11553      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11554    if (json.has("lastReviewDate"))
11555      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11556    if (json.has("_lastReviewDate"))
11557      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11558    if (json.has("effectivePeriod"))
11559      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11560    if (json.has("topic")) {
11561      JsonArray array = json.getAsJsonArray("topic");
11562      for (int i = 0; i < array.size(); i++) {
11563        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11564      }
11565    }
11566    ;
11567    if (json.has("author")) {
11568      JsonArray array = json.getAsJsonArray("author");
11569      for (int i = 0; i < array.size(); i++) {
11570        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11571      }
11572    }
11573    ;
11574    if (json.has("editor")) {
11575      JsonArray array = json.getAsJsonArray("editor");
11576      for (int i = 0; i < array.size(); i++) {
11577        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11578      }
11579    }
11580    ;
11581    if (json.has("reviewer")) {
11582      JsonArray array = json.getAsJsonArray("reviewer");
11583      for (int i = 0; i < array.size(); i++) {
11584        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11585      }
11586    }
11587    ;
11588    if (json.has("endorser")) {
11589      JsonArray array = json.getAsJsonArray("endorser");
11590      for (int i = 0; i < array.size(); i++) {
11591        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11592      }
11593    }
11594    ;
11595    if (json.has("relatedArtifact")) {
11596      JsonArray array = json.getAsJsonArray("relatedArtifact");
11597      for (int i = 0; i < array.size(); i++) {
11598        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11599      }
11600    }
11601    ;
11602    if (json.has("synthesisType"))
11603      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
11604    if (json.has("studyType"))
11605      res.setStudyType(parseCodeableConcept(getJObject(json, "studyType")));
11606    if (json.has("population"))
11607      res.setPopulation(parseReference(getJObject(json, "population")));
11608    if (json.has("exposure"))
11609      res.setExposure(parseReference(getJObject(json, "exposure")));
11610    if (json.has("exposureAlternative"))
11611      res.setExposureAlternative(parseReference(getJObject(json, "exposureAlternative")));
11612    if (json.has("outcome"))
11613      res.setOutcome(parseReference(getJObject(json, "outcome")));
11614    if (json.has("sampleSize"))
11615      res.setSampleSize(
11616          parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(getJObject(json, "sampleSize"), res));
11617    if (json.has("resultsByExposure")) {
11618      JsonArray array = json.getAsJsonArray("resultsByExposure");
11619      for (int i = 0; i < array.size(); i++) {
11620        res.getResultsByExposure().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(
11621            array.get(i).getAsJsonObject(), res));
11622      }
11623    }
11624    ;
11625    if (json.has("effectEstimate")) {
11626      JsonArray array = json.getAsJsonArray("effectEstimate");
11627      for (int i = 0; i < array.size(); i++) {
11628        res.getEffectEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(
11629            array.get(i).getAsJsonObject(), res));
11630      }
11631    }
11632    ;
11633    if (json.has("certainty")) {
11634      JsonArray array = json.getAsJsonArray("certainty");
11635      for (int i = 0; i < array.size(); i++) {
11636        res.getCertainty().add(
11637            parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
11638      }
11639    }
11640    ;
11641  }
11642
11643  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(
11644      JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
11645    EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent();
11646    parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
11647    return res;
11648  }
11649
11650  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(JsonObject json,
11651      EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res)
11652      throws IOException, FHIRFormatError {
11653    parseBackboneElementProperties(json, res);
11654    if (json.has("description"))
11655      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11656    if (json.has("_description"))
11657      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11658    if (json.has("numberOfStudies"))
11659      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
11660    if (json.has("_numberOfStudies"))
11661      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
11662    if (json.has("numberOfParticipants"))
11663      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
11664    if (json.has("_numberOfParticipants"))
11665      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
11666  }
11667
11668  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(
11669      JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
11670    EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent();
11671    parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(json, owner, res);
11672    return res;
11673  }
11674
11675  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(
11676      JsonObject json, EffectEvidenceSynthesis owner,
11677      EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res)
11678      throws IOException, FHIRFormatError {
11679    parseBackboneElementProperties(json, res);
11680    if (json.has("description"))
11681      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11682    if (json.has("_description"))
11683      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11684    if (json.has("exposureState"))
11685      res.setExposureStateElement(parseEnumeration(json.get("exposureState").getAsString(),
11686          EffectEvidenceSynthesis.ExposureState.NULL, new EffectEvidenceSynthesis.ExposureStateEnumFactory()));
11687    if (json.has("_exposureState"))
11688      parseElementProperties(getJObject(json, "_exposureState"), res.getExposureStateElement());
11689    if (json.has("variantState"))
11690      res.setVariantState(parseCodeableConcept(getJObject(json, "variantState")));
11691    if (json.has("riskEvidenceSynthesis"))
11692      res.setRiskEvidenceSynthesis(parseReference(getJObject(json, "riskEvidenceSynthesis")));
11693  }
11694
11695  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(
11696      JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
11697    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent();
11698    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(json, owner, res);
11699    return res;
11700  }
11701
11702  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(JsonObject json,
11703      EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res)
11704      throws IOException, FHIRFormatError {
11705    parseBackboneElementProperties(json, res);
11706    if (json.has("description"))
11707      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11708    if (json.has("_description"))
11709      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11710    if (json.has("type"))
11711      res.setType(parseCodeableConcept(getJObject(json, "type")));
11712    if (json.has("variantState"))
11713      res.setVariantState(parseCodeableConcept(getJObject(json, "variantState")));
11714    if (json.has("value"))
11715      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
11716    if (json.has("_value"))
11717      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
11718    if (json.has("unitOfMeasure"))
11719      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
11720    if (json.has("precisionEstimate")) {
11721      JsonArray array = json.getAsJsonArray("precisionEstimate");
11722      for (int i = 0; i < array.size(); i++) {
11723        res.getPrecisionEstimate()
11724            .add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(
11725                array.get(i).getAsJsonObject(), owner));
11726      }
11727    }
11728    ;
11729  }
11730
11731  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(
11732      JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
11733    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent();
11734    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(json, owner,
11735        res);
11736    return res;
11737  }
11738
11739  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(
11740      JsonObject json, EffectEvidenceSynthesis owner,
11741      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res)
11742      throws IOException, FHIRFormatError {
11743    parseBackboneElementProperties(json, res);
11744    if (json.has("type"))
11745      res.setType(parseCodeableConcept(getJObject(json, "type")));
11746    if (json.has("level"))
11747      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
11748    if (json.has("_level"))
11749      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
11750    if (json.has("from"))
11751      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
11752    if (json.has("_from"))
11753      parseElementProperties(getJObject(json, "_from"), res.getFromElement());
11754    if (json.has("to"))
11755      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
11756    if (json.has("_to"))
11757      parseElementProperties(getJObject(json, "_to"), res.getToElement());
11758  }
11759
11760  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(
11761      JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
11762    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent();
11763    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
11764    return res;
11765  }
11766
11767  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(JsonObject json,
11768      EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res)
11769      throws IOException, FHIRFormatError {
11770    parseBackboneElementProperties(json, res);
11771    if (json.has("rating")) {
11772      JsonArray array = json.getAsJsonArray("rating");
11773      for (int i = 0; i < array.size(); i++) {
11774        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11775      }
11776    }
11777    ;
11778    if (json.has("note")) {
11779      JsonArray array = json.getAsJsonArray("note");
11780      for (int i = 0; i < array.size(); i++) {
11781        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11782      }
11783    }
11784    ;
11785    if (json.has("certaintySubcomponent")) {
11786      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
11787      for (int i = 0; i < array.size(); i++) {
11788        res.getCertaintySubcomponent()
11789            .add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
11790                array.get(i).getAsJsonObject(), owner));
11791      }
11792    }
11793    ;
11794  }
11795
11796  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
11797      JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
11798    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
11799    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner,
11800        res);
11801    return res;
11802  }
11803
11804  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(
11805      JsonObject json, EffectEvidenceSynthesis owner,
11806      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res)
11807      throws IOException, FHIRFormatError {
11808    parseBackboneElementProperties(json, res);
11809    if (json.has("type"))
11810      res.setType(parseCodeableConcept(getJObject(json, "type")));
11811    if (json.has("rating")) {
11812      JsonArray array = json.getAsJsonArray("rating");
11813      for (int i = 0; i < array.size(); i++) {
11814        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11815      }
11816    }
11817    ;
11818    if (json.has("note")) {
11819      JsonArray array = json.getAsJsonArray("note");
11820      for (int i = 0; i < array.size(); i++) {
11821        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11822      }
11823    }
11824    ;
11825  }
11826
11827  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
11828    Encounter res = new Encounter();
11829    parseEncounterProperties(json, res);
11830    return res;
11831  }
11832
11833  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
11834    parseDomainResourceProperties(json, res);
11835    if (json.has("identifier")) {
11836      JsonArray array = json.getAsJsonArray("identifier");
11837      for (int i = 0; i < array.size(); i++) {
11838        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11839      }
11840    }
11841    ;
11842    if (json.has("status"))
11843      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL,
11844          new Encounter.EncounterStatusEnumFactory()));
11845    if (json.has("_status"))
11846      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11847    if (json.has("statusHistory")) {
11848      JsonArray array = json.getAsJsonArray("statusHistory");
11849      for (int i = 0; i < array.size(); i++) {
11850        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
11851      }
11852    }
11853    ;
11854    if (json.has("class"))
11855      res.setClass_(parseCoding(getJObject(json, "class")));
11856    if (json.has("classHistory")) {
11857      JsonArray array = json.getAsJsonArray("classHistory");
11858      for (int i = 0; i < array.size(); i++) {
11859        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
11860      }
11861    }
11862    ;
11863    if (json.has("type")) {
11864      JsonArray array = json.getAsJsonArray("type");
11865      for (int i = 0; i < array.size(); i++) {
11866        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11867      }
11868    }
11869    ;
11870    if (json.has("serviceType"))
11871      res.setServiceType(parseCodeableConcept(getJObject(json, "serviceType")));
11872    if (json.has("priority"))
11873      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
11874    if (json.has("subject"))
11875      res.setSubject(parseReference(getJObject(json, "subject")));
11876    if (json.has("episodeOfCare")) {
11877      JsonArray array = json.getAsJsonArray("episodeOfCare");
11878      for (int i = 0; i < array.size(); i++) {
11879        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
11880      }
11881    }
11882    ;
11883    if (json.has("basedOn")) {
11884      JsonArray array = json.getAsJsonArray("basedOn");
11885      for (int i = 0; i < array.size(); i++) {
11886        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11887      }
11888    }
11889    ;
11890    if (json.has("participant")) {
11891      JsonArray array = json.getAsJsonArray("participant");
11892      for (int i = 0; i < array.size(); i++) {
11893        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
11894      }
11895    }
11896    ;
11897    if (json.has("appointment")) {
11898      JsonArray array = json.getAsJsonArray("appointment");
11899      for (int i = 0; i < array.size(); i++) {
11900        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
11901      }
11902    }
11903    ;
11904    if (json.has("period"))
11905      res.setPeriod(parsePeriod(getJObject(json, "period")));
11906    if (json.has("length"))
11907      res.setLength(parseDuration(getJObject(json, "length")));
11908    if (json.has("reasonCode")) {
11909      JsonArray array = json.getAsJsonArray("reasonCode");
11910      for (int i = 0; i < array.size(); i++) {
11911        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11912      }
11913    }
11914    ;
11915    if (json.has("reasonReference")) {
11916      JsonArray array = json.getAsJsonArray("reasonReference");
11917      for (int i = 0; i < array.size(); i++) {
11918        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11919      }
11920    }
11921    ;
11922    if (json.has("diagnosis")) {
11923      JsonArray array = json.getAsJsonArray("diagnosis");
11924      for (int i = 0; i < array.size(); i++) {
11925        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
11926      }
11927    }
11928    ;
11929    if (json.has("account")) {
11930      JsonArray array = json.getAsJsonArray("account");
11931      for (int i = 0; i < array.size(); i++) {
11932        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11933      }
11934    }
11935    ;
11936    if (json.has("hospitalization"))
11937      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(getJObject(json, "hospitalization"), res));
11938    if (json.has("location")) {
11939      JsonArray array = json.getAsJsonArray("location");
11940      for (int i = 0; i < array.size(); i++) {
11941        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
11942      }
11943    }
11944    ;
11945    if (json.has("serviceProvider"))
11946      res.setServiceProvider(parseReference(getJObject(json, "serviceProvider")));
11947    if (json.has("partOf"))
11948      res.setPartOf(parseReference(getJObject(json, "partOf")));
11949  }
11950
11951  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner)
11952      throws IOException, FHIRFormatError {
11953    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
11954    parseEncounterStatusHistoryComponentProperties(json, owner, res);
11955    return res;
11956  }
11957
11958  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner,
11959      Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
11960    parseBackboneElementProperties(json, res);
11961    if (json.has("status"))
11962      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL,
11963          new Encounter.EncounterStatusEnumFactory()));
11964    if (json.has("_status"))
11965      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11966    if (json.has("period"))
11967      res.setPeriod(parsePeriod(getJObject(json, "period")));
11968  }
11969
11970  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner)
11971      throws IOException, FHIRFormatError {
11972    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
11973    parseEncounterClassHistoryComponentProperties(json, owner, res);
11974    return res;
11975  }
11976
11977  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner,
11978      Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
11979    parseBackboneElementProperties(json, res);
11980    if (json.has("class"))
11981      res.setClass_(parseCoding(getJObject(json, "class")));
11982    if (json.has("period"))
11983      res.setPeriod(parsePeriod(getJObject(json, "period")));
11984  }
11985
11986  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json,
11987      Encounter owner) throws IOException, FHIRFormatError {
11988    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
11989    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
11990    return res;
11991  }
11992
11993  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner,
11994      Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
11995    parseBackboneElementProperties(json, res);
11996    if (json.has("type")) {
11997      JsonArray array = json.getAsJsonArray("type");
11998      for (int i = 0; i < array.size(); i++) {
11999        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12000      }
12001    }
12002    ;
12003    if (json.has("period"))
12004      res.setPeriod(parsePeriod(getJObject(json, "period")));
12005    if (json.has("individual"))
12006      res.setIndividual(parseReference(getJObject(json, "individual")));
12007  }
12008
12009  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner)
12010      throws IOException, FHIRFormatError {
12011    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
12012    parseEncounterDiagnosisComponentProperties(json, owner, res);
12013    return res;
12014  }
12015
12016  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner,
12017      Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
12018    parseBackboneElementProperties(json, res);
12019    if (json.has("condition"))
12020      res.setCondition(parseReference(getJObject(json, "condition")));
12021    if (json.has("use"))
12022      res.setUse(parseCodeableConcept(getJObject(json, "use")));
12023    if (json.has("rank"))
12024      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
12025    if (json.has("_rank"))
12026      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
12027  }
12028
12029  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json,
12030      Encounter owner) throws IOException, FHIRFormatError {
12031    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
12032    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
12033    return res;
12034  }
12035
12036  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner,
12037      Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
12038    parseBackboneElementProperties(json, res);
12039    if (json.has("preAdmissionIdentifier"))
12040      res.setPreAdmissionIdentifier(parseIdentifier(getJObject(json, "preAdmissionIdentifier")));
12041    if (json.has("origin"))
12042      res.setOrigin(parseReference(getJObject(json, "origin")));
12043    if (json.has("admitSource"))
12044      res.setAdmitSource(parseCodeableConcept(getJObject(json, "admitSource")));
12045    if (json.has("reAdmission"))
12046      res.setReAdmission(parseCodeableConcept(getJObject(json, "reAdmission")));
12047    if (json.has("dietPreference")) {
12048      JsonArray array = json.getAsJsonArray("dietPreference");
12049      for (int i = 0; i < array.size(); i++) {
12050        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12051      }
12052    }
12053    ;
12054    if (json.has("specialCourtesy")) {
12055      JsonArray array = json.getAsJsonArray("specialCourtesy");
12056      for (int i = 0; i < array.size(); i++) {
12057        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12058      }
12059    }
12060    ;
12061    if (json.has("specialArrangement")) {
12062      JsonArray array = json.getAsJsonArray("specialArrangement");
12063      for (int i = 0; i < array.size(); i++) {
12064        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12065      }
12066    }
12067    ;
12068    if (json.has("destination"))
12069      res.setDestination(parseReference(getJObject(json, "destination")));
12070    if (json.has("dischargeDisposition"))
12071      res.setDischargeDisposition(parseCodeableConcept(getJObject(json, "dischargeDisposition")));
12072  }
12073
12074  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json,
12075      Encounter owner) throws IOException, FHIRFormatError {
12076    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
12077    parseEncounterEncounterLocationComponentProperties(json, owner, res);
12078    return res;
12079  }
12080
12081  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner,
12082      Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
12083    parseBackboneElementProperties(json, res);
12084    if (json.has("location"))
12085      res.setLocation(parseReference(getJObject(json, "location")));
12086    if (json.has("status"))
12087      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL,
12088          new Encounter.EncounterLocationStatusEnumFactory()));
12089    if (json.has("_status"))
12090      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12091    if (json.has("physicalType"))
12092      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
12093    if (json.has("period"))
12094      res.setPeriod(parsePeriod(getJObject(json, "period")));
12095  }
12096
12097  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
12098    Endpoint res = new Endpoint();
12099    parseEndpointProperties(json, res);
12100    return res;
12101  }
12102
12103  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
12104    parseDomainResourceProperties(json, res);
12105    if (json.has("identifier")) {
12106      JsonArray array = json.getAsJsonArray("identifier");
12107      for (int i = 0; i < array.size(); i++) {
12108        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12109      }
12110    }
12111    ;
12112    if (json.has("status"))
12113      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL,
12114          new Endpoint.EndpointStatusEnumFactory()));
12115    if (json.has("_status"))
12116      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12117    if (json.has("connectionType"))
12118      res.setConnectionType(parseCoding(getJObject(json, "connectionType")));
12119    if (json.has("name"))
12120      res.setNameElement(parseString(json.get("name").getAsString()));
12121    if (json.has("_name"))
12122      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12123    if (json.has("managingOrganization"))
12124      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
12125    if (json.has("contact")) {
12126      JsonArray array = json.getAsJsonArray("contact");
12127      for (int i = 0; i < array.size(); i++) {
12128        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
12129      }
12130    }
12131    ;
12132    if (json.has("period"))
12133      res.setPeriod(parsePeriod(getJObject(json, "period")));
12134    if (json.has("payloadType")) {
12135      JsonArray array = json.getAsJsonArray("payloadType");
12136      for (int i = 0; i < array.size(); i++) {
12137        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12138      }
12139    }
12140    ;
12141    if (json.has("payloadMimeType")) {
12142      JsonArray array = json.getAsJsonArray("payloadMimeType");
12143      for (int i = 0; i < array.size(); i++) {
12144        if (array.get(i).isJsonNull()) {
12145          res.getPayloadMimeType().add(new CodeType());
12146        } else {
12147          res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
12148        }
12149      }
12150    }
12151    ;
12152    if (json.has("_payloadMimeType")) {
12153      JsonArray array = json.getAsJsonArray("_payloadMimeType");
12154      for (int i = 0; i < array.size(); i++) {
12155        if (i == res.getPayloadMimeType().size())
12156          res.getPayloadMimeType().add(parseCode(null));
12157        if (array.get(i) instanceof JsonObject)
12158          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
12159      }
12160    }
12161    ;
12162    if (json.has("address"))
12163      res.setAddressElement(parseUrl(json.get("address").getAsString()));
12164    if (json.has("_address"))
12165      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
12166    if (json.has("header")) {
12167      JsonArray array = json.getAsJsonArray("header");
12168      for (int i = 0; i < array.size(); i++) {
12169        if (array.get(i).isJsonNull()) {
12170          res.getHeader().add(new StringType());
12171        } else {
12172          res.getHeader().add(parseString(array.get(i).getAsString()));
12173        }
12174      }
12175    }
12176    ;
12177    if (json.has("_header")) {
12178      JsonArray array = json.getAsJsonArray("_header");
12179      for (int i = 0; i < array.size(); i++) {
12180        if (i == res.getHeader().size())
12181          res.getHeader().add(parseString(null));
12182        if (array.get(i) instanceof JsonObject)
12183          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
12184      }
12185    }
12186    ;
12187  }
12188
12189  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
12190    EnrollmentRequest res = new EnrollmentRequest();
12191    parseEnrollmentRequestProperties(json, res);
12192    return res;
12193  }
12194
12195  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res)
12196      throws IOException, FHIRFormatError {
12197    parseDomainResourceProperties(json, res);
12198    if (json.has("identifier")) {
12199      JsonArray array = json.getAsJsonArray("identifier");
12200      for (int i = 0; i < array.size(); i++) {
12201        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12202      }
12203    }
12204    ;
12205    if (json.has("status"))
12206      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
12207          EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
12208    if (json.has("_status"))
12209      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12210    if (json.has("created"))
12211      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
12212    if (json.has("_created"))
12213      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
12214    if (json.has("insurer"))
12215      res.setInsurer(parseReference(getJObject(json, "insurer")));
12216    if (json.has("provider"))
12217      res.setProvider(parseReference(getJObject(json, "provider")));
12218    if (json.has("candidate"))
12219      res.setCandidate(parseReference(getJObject(json, "candidate")));
12220    if (json.has("coverage"))
12221      res.setCoverage(parseReference(getJObject(json, "coverage")));
12222  }
12223
12224  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
12225    EnrollmentResponse res = new EnrollmentResponse();
12226    parseEnrollmentResponseProperties(json, res);
12227    return res;
12228  }
12229
12230  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res)
12231      throws IOException, FHIRFormatError {
12232    parseDomainResourceProperties(json, res);
12233    if (json.has("identifier")) {
12234      JsonArray array = json.getAsJsonArray("identifier");
12235      for (int i = 0; i < array.size(); i++) {
12236        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12237      }
12238    }
12239    ;
12240    if (json.has("status"))
12241      res.setStatusElement(
12242          parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL,
12243              new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
12244    if (json.has("_status"))
12245      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12246    if (json.has("request"))
12247      res.setRequest(parseReference(getJObject(json, "request")));
12248    if (json.has("outcome"))
12249      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL,
12250          new Enumerations.RemittanceOutcomeEnumFactory()));
12251    if (json.has("_outcome"))
12252      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
12253    if (json.has("disposition"))
12254      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
12255    if (json.has("_disposition"))
12256      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
12257    if (json.has("created"))
12258      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
12259    if (json.has("_created"))
12260      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
12261    if (json.has("organization"))
12262      res.setOrganization(parseReference(getJObject(json, "organization")));
12263    if (json.has("requestProvider"))
12264      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
12265  }
12266
12267  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
12268    EpisodeOfCare res = new EpisodeOfCare();
12269    parseEpisodeOfCareProperties(json, res);
12270    return res;
12271  }
12272
12273  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
12274    parseDomainResourceProperties(json, res);
12275    if (json.has("identifier")) {
12276      JsonArray array = json.getAsJsonArray("identifier");
12277      for (int i = 0; i < array.size(); i++) {
12278        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12279      }
12280    }
12281    ;
12282    if (json.has("status"))
12283      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL,
12284          new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
12285    if (json.has("_status"))
12286      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12287    if (json.has("statusHistory")) {
12288      JsonArray array = json.getAsJsonArray("statusHistory");
12289      for (int i = 0; i < array.size(); i++) {
12290        res.getStatusHistory()
12291            .add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
12292      }
12293    }
12294    ;
12295    if (json.has("type")) {
12296      JsonArray array = json.getAsJsonArray("type");
12297      for (int i = 0; i < array.size(); i++) {
12298        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12299      }
12300    }
12301    ;
12302    if (json.has("diagnosis")) {
12303      JsonArray array = json.getAsJsonArray("diagnosis");
12304      for (int i = 0; i < array.size(); i++) {
12305        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
12306      }
12307    }
12308    ;
12309    if (json.has("patient"))
12310      res.setPatient(parseReference(getJObject(json, "patient")));
12311    if (json.has("managingOrganization"))
12312      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
12313    if (json.has("period"))
12314      res.setPeriod(parsePeriod(getJObject(json, "period")));
12315    if (json.has("referralRequest")) {
12316      JsonArray array = json.getAsJsonArray("referralRequest");
12317      for (int i = 0; i < array.size(); i++) {
12318        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
12319      }
12320    }
12321    ;
12322    if (json.has("careManager"))
12323      res.setCareManager(parseReference(getJObject(json, "careManager")));
12324    if (json.has("team")) {
12325      JsonArray array = json.getAsJsonArray("team");
12326      for (int i = 0; i < array.size(); i++) {
12327        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
12328      }
12329    }
12330    ;
12331    if (json.has("account")) {
12332      JsonArray array = json.getAsJsonArray("account");
12333      for (int i = 0; i < array.size(); i++) {
12334        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
12335      }
12336    }
12337    ;
12338  }
12339
12340  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(
12341      JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
12342    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
12343    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
12344    return res;
12345  }
12346
12347  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner,
12348      EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
12349    parseBackboneElementProperties(json, res);
12350    if (json.has("status"))
12351      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL,
12352          new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
12353    if (json.has("_status"))
12354      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12355    if (json.has("period"))
12356      res.setPeriod(parsePeriod(getJObject(json, "period")));
12357  }
12358
12359  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner)
12360      throws IOException, FHIRFormatError {
12361    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
12362    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
12363    return res;
12364  }
12365
12366  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner,
12367      EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
12368    parseBackboneElementProperties(json, res);
12369    if (json.has("condition"))
12370      res.setCondition(parseReference(getJObject(json, "condition")));
12371    if (json.has("role"))
12372      res.setRole(parseCodeableConcept(getJObject(json, "role")));
12373    if (json.has("rank"))
12374      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
12375    if (json.has("_rank"))
12376      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
12377  }
12378
12379  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
12380    EventDefinition res = new EventDefinition();
12381    parseEventDefinitionProperties(json, res);
12382    return res;
12383  }
12384
12385  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res)
12386      throws IOException, FHIRFormatError {
12387    parseDomainResourceProperties(json, res);
12388    if (json.has("url"))
12389      res.setUrlElement(parseUri(json.get("url").getAsString()));
12390    if (json.has("_url"))
12391      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12392    if (json.has("identifier")) {
12393      JsonArray array = json.getAsJsonArray("identifier");
12394      for (int i = 0; i < array.size(); i++) {
12395        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12396      }
12397    }
12398    ;
12399    if (json.has("version"))
12400      res.setVersionElement(parseString(json.get("version").getAsString()));
12401    if (json.has("_version"))
12402      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12403    if (json.has("name"))
12404      res.setNameElement(parseString(json.get("name").getAsString()));
12405    if (json.has("_name"))
12406      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12407    if (json.has("title"))
12408      res.setTitleElement(parseString(json.get("title").getAsString()));
12409    if (json.has("_title"))
12410      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
12411    if (json.has("subtitle"))
12412      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
12413    if (json.has("_subtitle"))
12414      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
12415    if (json.has("status"))
12416      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
12417          new Enumerations.PublicationStatusEnumFactory()));
12418    if (json.has("_status"))
12419      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12420    if (json.has("experimental"))
12421      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12422    if (json.has("_experimental"))
12423      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
12424    Type subject = parseType("subject", json);
12425    if (subject != null)
12426      res.setSubject(subject);
12427    if (json.has("date"))
12428      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12429    if (json.has("_date"))
12430      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12431    if (json.has("publisher"))
12432      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12433    if (json.has("_publisher"))
12434      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12435    if (json.has("contact")) {
12436      JsonArray array = json.getAsJsonArray("contact");
12437      for (int i = 0; i < array.size(); i++) {
12438        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12439      }
12440    }
12441    ;
12442    if (json.has("description"))
12443      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12444    if (json.has("_description"))
12445      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12446    if (json.has("useContext")) {
12447      JsonArray array = json.getAsJsonArray("useContext");
12448      for (int i = 0; i < array.size(); i++) {
12449        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12450      }
12451    }
12452    ;
12453    if (json.has("jurisdiction")) {
12454      JsonArray array = json.getAsJsonArray("jurisdiction");
12455      for (int i = 0; i < array.size(); i++) {
12456        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12457      }
12458    }
12459    ;
12460    if (json.has("purpose"))
12461      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12462    if (json.has("_purpose"))
12463      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
12464    if (json.has("usage"))
12465      res.setUsageElement(parseString(json.get("usage").getAsString()));
12466    if (json.has("_usage"))
12467      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
12468    if (json.has("copyright"))
12469      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12470    if (json.has("_copyright"))
12471      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
12472    if (json.has("approvalDate"))
12473      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12474    if (json.has("_approvalDate"))
12475      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
12476    if (json.has("lastReviewDate"))
12477      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12478    if (json.has("_lastReviewDate"))
12479      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
12480    if (json.has("effectivePeriod"))
12481      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
12482    if (json.has("topic")) {
12483      JsonArray array = json.getAsJsonArray("topic");
12484      for (int i = 0; i < array.size(); i++) {
12485        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12486      }
12487    }
12488    ;
12489    if (json.has("author")) {
12490      JsonArray array = json.getAsJsonArray("author");
12491      for (int i = 0; i < array.size(); i++) {
12492        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12493      }
12494    }
12495    ;
12496    if (json.has("editor")) {
12497      JsonArray array = json.getAsJsonArray("editor");
12498      for (int i = 0; i < array.size(); i++) {
12499        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12500      }
12501    }
12502    ;
12503    if (json.has("reviewer")) {
12504      JsonArray array = json.getAsJsonArray("reviewer");
12505      for (int i = 0; i < array.size(); i++) {
12506        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12507      }
12508    }
12509    ;
12510    if (json.has("endorser")) {
12511      JsonArray array = json.getAsJsonArray("endorser");
12512      for (int i = 0; i < array.size(); i++) {
12513        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12514      }
12515    }
12516    ;
12517    if (json.has("relatedArtifact")) {
12518      JsonArray array = json.getAsJsonArray("relatedArtifact");
12519      for (int i = 0; i < array.size(); i++) {
12520        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12521      }
12522    }
12523    ;
12524    if (json.has("trigger")) {
12525      JsonArray array = json.getAsJsonArray("trigger");
12526      for (int i = 0; i < array.size(); i++) {
12527        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
12528      }
12529    }
12530    ;
12531  }
12532
12533  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
12534    Evidence res = new Evidence();
12535    parseEvidenceProperties(json, res);
12536    return res;
12537  }
12538
12539  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
12540    parseDomainResourceProperties(json, res);
12541    if (json.has("url"))
12542      res.setUrlElement(parseUri(json.get("url").getAsString()));
12543    if (json.has("_url"))
12544      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12545    if (json.has("identifier")) {
12546      JsonArray array = json.getAsJsonArray("identifier");
12547      for (int i = 0; i < array.size(); i++) {
12548        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12549      }
12550    }
12551    ;
12552    if (json.has("version"))
12553      res.setVersionElement(parseString(json.get("version").getAsString()));
12554    if (json.has("_version"))
12555      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12556    if (json.has("name"))
12557      res.setNameElement(parseString(json.get("name").getAsString()));
12558    if (json.has("_name"))
12559      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12560    if (json.has("title"))
12561      res.setTitleElement(parseString(json.get("title").getAsString()));
12562    if (json.has("_title"))
12563      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
12564    if (json.has("shortTitle"))
12565      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
12566    if (json.has("_shortTitle"))
12567      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
12568    if (json.has("subtitle"))
12569      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
12570    if (json.has("_subtitle"))
12571      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
12572    if (json.has("status"))
12573      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
12574          new Enumerations.PublicationStatusEnumFactory()));
12575    if (json.has("_status"))
12576      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12577    if (json.has("date"))
12578      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12579    if (json.has("_date"))
12580      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12581    if (json.has("publisher"))
12582      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12583    if (json.has("_publisher"))
12584      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12585    if (json.has("contact")) {
12586      JsonArray array = json.getAsJsonArray("contact");
12587      for (int i = 0; i < array.size(); i++) {
12588        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12589      }
12590    }
12591    ;
12592    if (json.has("description"))
12593      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12594    if (json.has("_description"))
12595      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12596    if (json.has("note")) {
12597      JsonArray array = json.getAsJsonArray("note");
12598      for (int i = 0; i < array.size(); i++) {
12599        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12600      }
12601    }
12602    ;
12603    if (json.has("useContext")) {
12604      JsonArray array = json.getAsJsonArray("useContext");
12605      for (int i = 0; i < array.size(); i++) {
12606        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12607      }
12608    }
12609    ;
12610    if (json.has("jurisdiction")) {
12611      JsonArray array = json.getAsJsonArray("jurisdiction");
12612      for (int i = 0; i < array.size(); i++) {
12613        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12614      }
12615    }
12616    ;
12617    if (json.has("copyright"))
12618      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12619    if (json.has("_copyright"))
12620      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
12621    if (json.has("approvalDate"))
12622      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12623    if (json.has("_approvalDate"))
12624      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
12625    if (json.has("lastReviewDate"))
12626      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12627    if (json.has("_lastReviewDate"))
12628      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
12629    if (json.has("effectivePeriod"))
12630      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
12631    if (json.has("topic")) {
12632      JsonArray array = json.getAsJsonArray("topic");
12633      for (int i = 0; i < array.size(); i++) {
12634        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12635      }
12636    }
12637    ;
12638    if (json.has("author")) {
12639      JsonArray array = json.getAsJsonArray("author");
12640      for (int i = 0; i < array.size(); i++) {
12641        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12642      }
12643    }
12644    ;
12645    if (json.has("editor")) {
12646      JsonArray array = json.getAsJsonArray("editor");
12647      for (int i = 0; i < array.size(); i++) {
12648        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12649      }
12650    }
12651    ;
12652    if (json.has("reviewer")) {
12653      JsonArray array = json.getAsJsonArray("reviewer");
12654      for (int i = 0; i < array.size(); i++) {
12655        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12656      }
12657    }
12658    ;
12659    if (json.has("endorser")) {
12660      JsonArray array = json.getAsJsonArray("endorser");
12661      for (int i = 0; i < array.size(); i++) {
12662        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12663      }
12664    }
12665    ;
12666    if (json.has("relatedArtifact")) {
12667      JsonArray array = json.getAsJsonArray("relatedArtifact");
12668      for (int i = 0; i < array.size(); i++) {
12669        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12670      }
12671    }
12672    ;
12673    if (json.has("exposureBackground"))
12674      res.setExposureBackground(parseReference(getJObject(json, "exposureBackground")));
12675    if (json.has("exposureVariant")) {
12676      JsonArray array = json.getAsJsonArray("exposureVariant");
12677      for (int i = 0; i < array.size(); i++) {
12678        res.getExposureVariant().add(parseReference(array.get(i).getAsJsonObject()));
12679      }
12680    }
12681    ;
12682    if (json.has("outcome")) {
12683      JsonArray array = json.getAsJsonArray("outcome");
12684      for (int i = 0; i < array.size(); i++) {
12685        res.getOutcome().add(parseReference(array.get(i).getAsJsonObject()));
12686      }
12687    }
12688    ;
12689  }
12690
12691  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
12692    EvidenceVariable res = new EvidenceVariable();
12693    parseEvidenceVariableProperties(json, res);
12694    return res;
12695  }
12696
12697  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res)
12698      throws IOException, FHIRFormatError {
12699    parseDomainResourceProperties(json, res);
12700    if (json.has("url"))
12701      res.setUrlElement(parseUri(json.get("url").getAsString()));
12702    if (json.has("_url"))
12703      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12704    if (json.has("identifier")) {
12705      JsonArray array = json.getAsJsonArray("identifier");
12706      for (int i = 0; i < array.size(); i++) {
12707        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12708      }
12709    }
12710    ;
12711    if (json.has("version"))
12712      res.setVersionElement(parseString(json.get("version").getAsString()));
12713    if (json.has("_version"))
12714      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12715    if (json.has("name"))
12716      res.setNameElement(parseString(json.get("name").getAsString()));
12717    if (json.has("_name"))
12718      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12719    if (json.has("title"))
12720      res.setTitleElement(parseString(json.get("title").getAsString()));
12721    if (json.has("_title"))
12722      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
12723    if (json.has("shortTitle"))
12724      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
12725    if (json.has("_shortTitle"))
12726      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
12727    if (json.has("subtitle"))
12728      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
12729    if (json.has("_subtitle"))
12730      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
12731    if (json.has("status"))
12732      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
12733          new Enumerations.PublicationStatusEnumFactory()));
12734    if (json.has("_status"))
12735      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12736    if (json.has("date"))
12737      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12738    if (json.has("_date"))
12739      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12740    if (json.has("publisher"))
12741      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12742    if (json.has("_publisher"))
12743      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12744    if (json.has("contact")) {
12745      JsonArray array = json.getAsJsonArray("contact");
12746      for (int i = 0; i < array.size(); i++) {
12747        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12748      }
12749    }
12750    ;
12751    if (json.has("description"))
12752      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12753    if (json.has("_description"))
12754      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12755    if (json.has("note")) {
12756      JsonArray array = json.getAsJsonArray("note");
12757      for (int i = 0; i < array.size(); i++) {
12758        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12759      }
12760    }
12761    ;
12762    if (json.has("useContext")) {
12763      JsonArray array = json.getAsJsonArray("useContext");
12764      for (int i = 0; i < array.size(); i++) {
12765        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12766      }
12767    }
12768    ;
12769    if (json.has("jurisdiction")) {
12770      JsonArray array = json.getAsJsonArray("jurisdiction");
12771      for (int i = 0; i < array.size(); i++) {
12772        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12773      }
12774    }
12775    ;
12776    if (json.has("copyright"))
12777      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12778    if (json.has("_copyright"))
12779      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
12780    if (json.has("approvalDate"))
12781      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12782    if (json.has("_approvalDate"))
12783      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
12784    if (json.has("lastReviewDate"))
12785      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12786    if (json.has("_lastReviewDate"))
12787      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
12788    if (json.has("effectivePeriod"))
12789      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
12790    if (json.has("topic")) {
12791      JsonArray array = json.getAsJsonArray("topic");
12792      for (int i = 0; i < array.size(); i++) {
12793        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12794      }
12795    }
12796    ;
12797    if (json.has("author")) {
12798      JsonArray array = json.getAsJsonArray("author");
12799      for (int i = 0; i < array.size(); i++) {
12800        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12801      }
12802    }
12803    ;
12804    if (json.has("editor")) {
12805      JsonArray array = json.getAsJsonArray("editor");
12806      for (int i = 0; i < array.size(); i++) {
12807        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12808      }
12809    }
12810    ;
12811    if (json.has("reviewer")) {
12812      JsonArray array = json.getAsJsonArray("reviewer");
12813      for (int i = 0; i < array.size(); i++) {
12814        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12815      }
12816    }
12817    ;
12818    if (json.has("endorser")) {
12819      JsonArray array = json.getAsJsonArray("endorser");
12820      for (int i = 0; i < array.size(); i++) {
12821        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12822      }
12823    }
12824    ;
12825    if (json.has("relatedArtifact")) {
12826      JsonArray array = json.getAsJsonArray("relatedArtifact");
12827      for (int i = 0; i < array.size(); i++) {
12828        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12829      }
12830    }
12831    ;
12832    if (json.has("type"))
12833      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), EvidenceVariable.EvidenceVariableType.NULL,
12834          new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
12835    if (json.has("_type"))
12836      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12837    if (json.has("characteristic")) {
12838      JsonArray array = json.getAsJsonArray("characteristic");
12839      for (int i = 0; i < array.size(); i++) {
12840        res.getCharacteristic()
12841            .add(parseEvidenceVariableEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject(), res));
12842      }
12843    }
12844    ;
12845  }
12846
12847  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableEvidenceVariableCharacteristicComponent(
12848      JsonObject json, EvidenceVariable owner) throws IOException, FHIRFormatError {
12849    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
12850    parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(json, owner, res);
12851    return res;
12852  }
12853
12854  protected void parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(JsonObject json,
12855      EvidenceVariable owner, EvidenceVariable.EvidenceVariableCharacteristicComponent res)
12856      throws IOException, FHIRFormatError {
12857    parseBackboneElementProperties(json, res);
12858    if (json.has("description"))
12859      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12860    if (json.has("_description"))
12861      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12862    Type definition = parseType("definition", json);
12863    if (definition != null)
12864      res.setDefinition(definition);
12865    if (json.has("usageContext")) {
12866      JsonArray array = json.getAsJsonArray("usageContext");
12867      for (int i = 0; i < array.size(); i++) {
12868        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12869      }
12870    }
12871    ;
12872    if (json.has("exclude"))
12873      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
12874    if (json.has("_exclude"))
12875      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
12876    Type participantEffective = parseType("participantEffective", json);
12877    if (participantEffective != null)
12878      res.setParticipantEffective(participantEffective);
12879    if (json.has("timeFromStart"))
12880      res.setTimeFromStart(parseDuration(getJObject(json, "timeFromStart")));
12881    if (json.has("groupMeasure"))
12882      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(),
12883          EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
12884    if (json.has("_groupMeasure"))
12885      parseElementProperties(getJObject(json, "_groupMeasure"), res.getGroupMeasureElement());
12886  }
12887
12888  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
12889    ExampleScenario res = new ExampleScenario();
12890    parseExampleScenarioProperties(json, res);
12891    return res;
12892  }
12893
12894  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res)
12895      throws IOException, FHIRFormatError {
12896    parseDomainResourceProperties(json, res);
12897    if (json.has("url"))
12898      res.setUrlElement(parseUri(json.get("url").getAsString()));
12899    if (json.has("_url"))
12900      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12901    if (json.has("identifier")) {
12902      JsonArray array = json.getAsJsonArray("identifier");
12903      for (int i = 0; i < array.size(); i++) {
12904        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12905      }
12906    }
12907    ;
12908    if (json.has("version"))
12909      res.setVersionElement(parseString(json.get("version").getAsString()));
12910    if (json.has("_version"))
12911      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12912    if (json.has("name"))
12913      res.setNameElement(parseString(json.get("name").getAsString()));
12914    if (json.has("_name"))
12915      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12916    if (json.has("status"))
12917      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
12918          new Enumerations.PublicationStatusEnumFactory()));
12919    if (json.has("_status"))
12920      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12921    if (json.has("experimental"))
12922      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12923    if (json.has("_experimental"))
12924      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
12925    if (json.has("date"))
12926      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12927    if (json.has("_date"))
12928      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12929    if (json.has("publisher"))
12930      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12931    if (json.has("_publisher"))
12932      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12933    if (json.has("contact")) {
12934      JsonArray array = json.getAsJsonArray("contact");
12935      for (int i = 0; i < array.size(); i++) {
12936        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12937      }
12938    }
12939    ;
12940    if (json.has("useContext")) {
12941      JsonArray array = json.getAsJsonArray("useContext");
12942      for (int i = 0; i < array.size(); i++) {
12943        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12944      }
12945    }
12946    ;
12947    if (json.has("jurisdiction")) {
12948      JsonArray array = json.getAsJsonArray("jurisdiction");
12949      for (int i = 0; i < array.size(); i++) {
12950        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12951      }
12952    }
12953    ;
12954    if (json.has("copyright"))
12955      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12956    if (json.has("_copyright"))
12957      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
12958    if (json.has("purpose"))
12959      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12960    if (json.has("_purpose"))
12961      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
12962    if (json.has("actor")) {
12963      JsonArray array = json.getAsJsonArray("actor");
12964      for (int i = 0; i < array.size(); i++) {
12965        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
12966      }
12967    }
12968    ;
12969    if (json.has("instance")) {
12970      JsonArray array = json.getAsJsonArray("instance");
12971      for (int i = 0; i < array.size(); i++) {
12972        res.getInstance()
12973            .add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
12974      }
12975    }
12976    ;
12977    if (json.has("process")) {
12978      JsonArray array = json.getAsJsonArray("process");
12979      for (int i = 0; i < array.size(); i++) {
12980        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
12981      }
12982    }
12983    ;
12984    if (json.has("workflow")) {
12985      JsonArray array = json.getAsJsonArray("workflow");
12986      for (int i = 0; i < array.size(); i++) {
12987        if (array.get(i).isJsonNull()) {
12988          res.getWorkflow().add(new CanonicalType());
12989        } else {
12990          res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
12991        }
12992      }
12993    }
12994    ;
12995    if (json.has("_workflow")) {
12996      JsonArray array = json.getAsJsonArray("_workflow");
12997      for (int i = 0; i < array.size(); i++) {
12998        if (i == res.getWorkflow().size())
12999          res.getWorkflow().add(parseCanonical(null));
13000        if (array.get(i) instanceof JsonObject)
13001          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
13002      }
13003    }
13004    ;
13005  }
13006
13007  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(
13008      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13009    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
13010    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
13011    return res;
13012  }
13013
13014  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner,
13015      ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
13016    parseBackboneElementProperties(json, res);
13017    if (json.has("actorId"))
13018      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
13019    if (json.has("_actorId"))
13020      parseElementProperties(getJObject(json, "_actorId"), res.getActorIdElement());
13021    if (json.has("type"))
13022      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL,
13023          new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
13024    if (json.has("_type"))
13025      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13026    if (json.has("name"))
13027      res.setNameElement(parseString(json.get("name").getAsString()));
13028    if (json.has("_name"))
13029      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13030    if (json.has("description"))
13031      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13032    if (json.has("_description"))
13033      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13034  }
13035
13036  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(
13037      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13038    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
13039    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
13040    return res;
13041  }
13042
13043  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner,
13044      ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
13045    parseBackboneElementProperties(json, res);
13046    if (json.has("resourceId"))
13047      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
13048    if (json.has("_resourceId"))
13049      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
13050    if (json.has("resourceType"))
13051      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(),
13052          ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
13053    if (json.has("_resourceType"))
13054      parseElementProperties(getJObject(json, "_resourceType"), res.getResourceTypeElement());
13055    if (json.has("name"))
13056      res.setNameElement(parseString(json.get("name").getAsString()));
13057    if (json.has("_name"))
13058      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13059    if (json.has("description"))
13060      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13061    if (json.has("_description"))
13062      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13063    if (json.has("version")) {
13064      JsonArray array = json.getAsJsonArray("version");
13065      for (int i = 0; i < array.size(); i++) {
13066        res.getVersion()
13067            .add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
13068      }
13069    }
13070    ;
13071    if (json.has("containedInstance")) {
13072      JsonArray array = json.getAsJsonArray("containedInstance");
13073      for (int i = 0; i < array.size(); i++) {
13074        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(
13075            array.get(i).getAsJsonObject(), owner));
13076      }
13077    }
13078    ;
13079  }
13080
13081  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(
13082      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13083    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
13084    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
13085    return res;
13086  }
13087
13088  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json,
13089      ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res)
13090      throws IOException, FHIRFormatError {
13091    parseBackboneElementProperties(json, res);
13092    if (json.has("versionId"))
13093      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
13094    if (json.has("_versionId"))
13095      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
13096    if (json.has("description"))
13097      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13098    if (json.has("_description"))
13099      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13100  }
13101
13102  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(
13103      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13104    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
13105    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
13106    return res;
13107  }
13108
13109  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json,
13110      ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res)
13111      throws IOException, FHIRFormatError {
13112    parseBackboneElementProperties(json, res);
13113    if (json.has("resourceId"))
13114      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
13115    if (json.has("_resourceId"))
13116      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
13117    if (json.has("versionId"))
13118      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
13119    if (json.has("_versionId"))
13120      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
13121  }
13122
13123  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(
13124      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13125    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
13126    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
13127    return res;
13128  }
13129
13130  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner,
13131      ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
13132    parseBackboneElementProperties(json, res);
13133    if (json.has("title"))
13134      res.setTitleElement(parseString(json.get("title").getAsString()));
13135    if (json.has("_title"))
13136      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
13137    if (json.has("description"))
13138      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13139    if (json.has("_description"))
13140      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13141    if (json.has("preConditions"))
13142      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
13143    if (json.has("_preConditions"))
13144      parseElementProperties(getJObject(json, "_preConditions"), res.getPreConditionsElement());
13145    if (json.has("postConditions"))
13146      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
13147    if (json.has("_postConditions"))
13148      parseElementProperties(getJObject(json, "_postConditions"), res.getPostConditionsElement());
13149    if (json.has("step")) {
13150      JsonArray array = json.getAsJsonArray("step");
13151      for (int i = 0; i < array.size(); i++) {
13152        res.getStep()
13153            .add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
13154      }
13155    }
13156    ;
13157  }
13158
13159  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(
13160      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13161    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
13162    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
13163    return res;
13164  }
13165
13166  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json,
13167      ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res)
13168      throws IOException, FHIRFormatError {
13169    parseBackboneElementProperties(json, res);
13170    if (json.has("process")) {
13171      JsonArray array = json.getAsJsonArray("process");
13172      for (int i = 0; i < array.size(); i++) {
13173        res.getProcess()
13174            .add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
13175      }
13176    }
13177    ;
13178    if (json.has("pause"))
13179      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
13180    if (json.has("_pause"))
13181      parseElementProperties(getJObject(json, "_pause"), res.getPauseElement());
13182    if (json.has("operation"))
13183      res.setOperation(
13184          parseExampleScenarioExampleScenarioProcessStepOperationComponent(getJObject(json, "operation"), owner));
13185    if (json.has("alternative")) {
13186      JsonArray array = json.getAsJsonArray("alternative");
13187      for (int i = 0; i < array.size(); i++) {
13188        res.getAlternative().add(
13189            parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject(), owner));
13190      }
13191    }
13192    ;
13193  }
13194
13195  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(
13196      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13197    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
13198    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
13199    return res;
13200  }
13201
13202  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json,
13203      ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res)
13204      throws IOException, FHIRFormatError {
13205    parseBackboneElementProperties(json, res);
13206    if (json.has("number"))
13207      res.setNumberElement(parseString(json.get("number").getAsString()));
13208    if (json.has("_number"))
13209      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
13210    if (json.has("type"))
13211      res.setTypeElement(parseString(json.get("type").getAsString()));
13212    if (json.has("_type"))
13213      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13214    if (json.has("name"))
13215      res.setNameElement(parseString(json.get("name").getAsString()));
13216    if (json.has("_name"))
13217      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13218    if (json.has("initiator"))
13219      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
13220    if (json.has("_initiator"))
13221      parseElementProperties(getJObject(json, "_initiator"), res.getInitiatorElement());
13222    if (json.has("receiver"))
13223      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
13224    if (json.has("_receiver"))
13225      parseElementProperties(getJObject(json, "_receiver"), res.getReceiverElement());
13226    if (json.has("description"))
13227      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13228    if (json.has("_description"))
13229      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13230    if (json.has("initiatorActive"))
13231      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
13232    if (json.has("_initiatorActive"))
13233      parseElementProperties(getJObject(json, "_initiatorActive"), res.getInitiatorActiveElement());
13234    if (json.has("receiverActive"))
13235      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
13236    if (json.has("_receiverActive"))
13237      parseElementProperties(getJObject(json, "_receiverActive"), res.getReceiverActiveElement());
13238    if (json.has("request"))
13239      res.setRequest(
13240          parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "request"), owner));
13241    if (json.has("response"))
13242      res.setResponse(
13243          parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "response"), owner));
13244  }
13245
13246  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(
13247      JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
13248    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
13249    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
13250    return res;
13251  }
13252
13253  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json,
13254      ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res)
13255      throws IOException, FHIRFormatError {
13256    parseBackboneElementProperties(json, res);
13257    if (json.has("title"))
13258      res.setTitleElement(parseString(json.get("title").getAsString()));
13259    if (json.has("_title"))
13260      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
13261    if (json.has("description"))
13262      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13263    if (json.has("_description"))
13264      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13265    if (json.has("step")) {
13266      JsonArray array = json.getAsJsonArray("step");
13267      for (int i = 0; i < array.size(); i++) {
13268        res.getStep()
13269            .add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
13270      }
13271    }
13272    ;
13273  }
13274
13275  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
13276    ExplanationOfBenefit res = new ExplanationOfBenefit();
13277    parseExplanationOfBenefitProperties(json, res);
13278    return res;
13279  }
13280
13281  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res)
13282      throws IOException, FHIRFormatError {
13283    parseDomainResourceProperties(json, res);
13284    if (json.has("identifier")) {
13285      JsonArray array = json.getAsJsonArray("identifier");
13286      for (int i = 0; i < array.size(); i++) {
13287        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13288      }
13289    }
13290    ;
13291    if (json.has("status"))
13292      res.setStatusElement(
13293          parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL,
13294              new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
13295    if (json.has("_status"))
13296      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13297    if (json.has("type"))
13298      res.setType(parseCodeableConcept(getJObject(json, "type")));
13299    if (json.has("subType"))
13300      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
13301    if (json.has("use"))
13302      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL,
13303          new ExplanationOfBenefit.UseEnumFactory()));
13304    if (json.has("_use"))
13305      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
13306    if (json.has("patient"))
13307      res.setPatient(parseReference(getJObject(json, "patient")));
13308    if (json.has("billablePeriod"))
13309      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
13310    if (json.has("created"))
13311      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
13312    if (json.has("_created"))
13313      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
13314    if (json.has("enterer"))
13315      res.setEnterer(parseReference(getJObject(json, "enterer")));
13316    if (json.has("insurer"))
13317      res.setInsurer(parseReference(getJObject(json, "insurer")));
13318    if (json.has("provider"))
13319      res.setProvider(parseReference(getJObject(json, "provider")));
13320    if (json.has("priority"))
13321      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
13322    if (json.has("fundsReserveRequested"))
13323      res.setFundsReserveRequested(parseCodeableConcept(getJObject(json, "fundsReserveRequested")));
13324    if (json.has("fundsReserve"))
13325      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
13326    if (json.has("related")) {
13327      JsonArray array = json.getAsJsonArray("related");
13328      for (int i = 0; i < array.size(); i++) {
13329        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
13330      }
13331    }
13332    ;
13333    if (json.has("prescription"))
13334      res.setPrescription(parseReference(getJObject(json, "prescription")));
13335    if (json.has("originalPrescription"))
13336      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
13337    if (json.has("payee"))
13338      res.setPayee(parseExplanationOfBenefitPayeeComponent(getJObject(json, "payee"), res));
13339    if (json.has("referral"))
13340      res.setReferral(parseReference(getJObject(json, "referral")));
13341    if (json.has("facility"))
13342      res.setFacility(parseReference(getJObject(json, "facility")));
13343    if (json.has("claim"))
13344      res.setClaim(parseReference(getJObject(json, "claim")));
13345    if (json.has("claimResponse"))
13346      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
13347    if (json.has("outcome"))
13348      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(),
13349          ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
13350    if (json.has("_outcome"))
13351      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
13352    if (json.has("disposition"))
13353      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
13354    if (json.has("_disposition"))
13355      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
13356    if (json.has("preAuthRef")) {
13357      JsonArray array = json.getAsJsonArray("preAuthRef");
13358      for (int i = 0; i < array.size(); i++) {
13359        if (array.get(i).isJsonNull()) {
13360          res.getPreAuthRef().add(new StringType());
13361        } else {
13362          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
13363        }
13364      }
13365    }
13366    ;
13367    if (json.has("_preAuthRef")) {
13368      JsonArray array = json.getAsJsonArray("_preAuthRef");
13369      for (int i = 0; i < array.size(); i++) {
13370        if (i == res.getPreAuthRef().size())
13371          res.getPreAuthRef().add(parseString(null));
13372        if (array.get(i) instanceof JsonObject)
13373          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
13374      }
13375    }
13376    ;
13377    if (json.has("preAuthRefPeriod")) {
13378      JsonArray array = json.getAsJsonArray("preAuthRefPeriod");
13379      for (int i = 0; i < array.size(); i++) {
13380        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
13381      }
13382    }
13383    ;
13384    if (json.has("careTeam")) {
13385      JsonArray array = json.getAsJsonArray("careTeam");
13386      for (int i = 0; i < array.size(); i++) {
13387        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
13388      }
13389    }
13390    ;
13391    if (json.has("supportingInfo")) {
13392      JsonArray array = json.getAsJsonArray("supportingInfo");
13393      for (int i = 0; i < array.size(); i++) {
13394        res.getSupportingInfo()
13395            .add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
13396      }
13397    }
13398    ;
13399    if (json.has("diagnosis")) {
13400      JsonArray array = json.getAsJsonArray("diagnosis");
13401      for (int i = 0; i < array.size(); i++) {
13402        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
13403      }
13404    }
13405    ;
13406    if (json.has("procedure")) {
13407      JsonArray array = json.getAsJsonArray("procedure");
13408      for (int i = 0; i < array.size(); i++) {
13409        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
13410      }
13411    }
13412    ;
13413    if (json.has("precedence"))
13414      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
13415    if (json.has("_precedence"))
13416      parseElementProperties(getJObject(json, "_precedence"), res.getPrecedenceElement());
13417    if (json.has("insurance")) {
13418      JsonArray array = json.getAsJsonArray("insurance");
13419      for (int i = 0; i < array.size(); i++) {
13420        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject(), res));
13421      }
13422    }
13423    ;
13424    if (json.has("accident"))
13425      res.setAccident(parseExplanationOfBenefitAccidentComponent(getJObject(json, "accident"), res));
13426    if (json.has("item")) {
13427      JsonArray array = json.getAsJsonArray("item");
13428      for (int i = 0; i < array.size(); i++) {
13429        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
13430      }
13431    }
13432    ;
13433    if (json.has("addItem")) {
13434      JsonArray array = json.getAsJsonArray("addItem");
13435      for (int i = 0; i < array.size(); i++) {
13436        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
13437      }
13438    }
13439    ;
13440    if (json.has("adjudication")) {
13441      JsonArray array = json.getAsJsonArray("adjudication");
13442      for (int i = 0; i < array.size(); i++) {
13443        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), res));
13444      }
13445    }
13446    ;
13447    if (json.has("total")) {
13448      JsonArray array = json.getAsJsonArray("total");
13449      for (int i = 0; i < array.size(); i++) {
13450        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
13451      }
13452    }
13453    ;
13454    if (json.has("payment"))
13455      res.setPayment(parseExplanationOfBenefitPaymentComponent(getJObject(json, "payment"), res));
13456    if (json.has("formCode"))
13457      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
13458    if (json.has("form"))
13459      res.setForm(parseAttachment(getJObject(json, "form")));
13460    if (json.has("processNote")) {
13461      JsonArray array = json.getAsJsonArray("processNote");
13462      for (int i = 0; i < array.size(); i++) {
13463        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
13464      }
13465    }
13466    ;
13467    if (json.has("benefitPeriod"))
13468      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
13469    if (json.has("benefitBalance")) {
13470      JsonArray array = json.getAsJsonArray("benefitBalance");
13471      for (int i = 0; i < array.size(); i++) {
13472        res.getBenefitBalance()
13473            .add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
13474      }
13475    }
13476    ;
13477  }
13478
13479  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json,
13480      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13481    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
13482    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
13483    return res;
13484  }
13485
13486  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13487      ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
13488    parseBackboneElementProperties(json, res);
13489    if (json.has("claim"))
13490      res.setClaim(parseReference(getJObject(json, "claim")));
13491    if (json.has("relationship"))
13492      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
13493    if (json.has("reference"))
13494      res.setReference(parseIdentifier(getJObject(json, "reference")));
13495  }
13496
13497  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json,
13498      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13499    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
13500    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
13501    return res;
13502  }
13503
13504  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13505      ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
13506    parseBackboneElementProperties(json, res);
13507    if (json.has("type"))
13508      res.setType(parseCodeableConcept(getJObject(json, "type")));
13509    if (json.has("party"))
13510      res.setParty(parseReference(getJObject(json, "party")));
13511  }
13512
13513  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json,
13514      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13515    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
13516    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
13517    return res;
13518  }
13519
13520  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13521      ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
13522    parseBackboneElementProperties(json, res);
13523    if (json.has("sequence"))
13524      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13525    if (json.has("_sequence"))
13526      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13527    if (json.has("provider"))
13528      res.setProvider(parseReference(getJObject(json, "provider")));
13529    if (json.has("responsible"))
13530      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
13531    if (json.has("_responsible"))
13532      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
13533    if (json.has("role"))
13534      res.setRole(parseCodeableConcept(getJObject(json, "role")));
13535    if (json.has("qualification"))
13536      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
13537  }
13538
13539  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(
13540      JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13541    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
13542    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
13543    return res;
13544  }
13545
13546  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json,
13547      ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res)
13548      throws IOException, FHIRFormatError {
13549    parseBackboneElementProperties(json, res);
13550    if (json.has("sequence"))
13551      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13552    if (json.has("_sequence"))
13553      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13554    if (json.has("category"))
13555      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13556    if (json.has("code"))
13557      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13558    Type timing = parseType("timing", json);
13559    if (timing != null)
13560      res.setTiming(timing);
13561    Type value = parseType("value", json);
13562    if (value != null)
13563      res.setValue(value);
13564    if (json.has("reason"))
13565      res.setReason(parseCoding(getJObject(json, "reason")));
13566  }
13567
13568  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json,
13569      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13570    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
13571    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
13572    return res;
13573  }
13574
13575  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13576      ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
13577    parseBackboneElementProperties(json, res);
13578    if (json.has("sequence"))
13579      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13580    if (json.has("_sequence"))
13581      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13582    Type diagnosis = parseType("diagnosis", json);
13583    if (diagnosis != null)
13584      res.setDiagnosis(diagnosis);
13585    if (json.has("type")) {
13586      JsonArray array = json.getAsJsonArray("type");
13587      for (int i = 0; i < array.size(); i++) {
13588        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13589      }
13590    }
13591    ;
13592    if (json.has("onAdmission"))
13593      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
13594    if (json.has("packageCode"))
13595      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
13596  }
13597
13598  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json,
13599      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13600    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
13601    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
13602    return res;
13603  }
13604
13605  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13606      ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
13607    parseBackboneElementProperties(json, res);
13608    if (json.has("sequence"))
13609      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13610    if (json.has("_sequence"))
13611      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13612    if (json.has("type")) {
13613      JsonArray array = json.getAsJsonArray("type");
13614      for (int i = 0; i < array.size(); i++) {
13615        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13616      }
13617    }
13618    ;
13619    if (json.has("date"))
13620      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13621    if (json.has("_date"))
13622      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13623    Type procedure = parseType("procedure", json);
13624    if (procedure != null)
13625      res.setProcedure(procedure);
13626    if (json.has("udi")) {
13627      JsonArray array = json.getAsJsonArray("udi");
13628      for (int i = 0; i < array.size(); i++) {
13629        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13630      }
13631    }
13632    ;
13633  }
13634
13635  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json,
13636      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13637    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
13638    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
13639    return res;
13640  }
13641
13642  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13643      ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
13644    parseBackboneElementProperties(json, res);
13645    if (json.has("focal"))
13646      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
13647    if (json.has("_focal"))
13648      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
13649    if (json.has("coverage"))
13650      res.setCoverage(parseReference(getJObject(json, "coverage")));
13651    if (json.has("preAuthRef")) {
13652      JsonArray array = json.getAsJsonArray("preAuthRef");
13653      for (int i = 0; i < array.size(); i++) {
13654        if (array.get(i).isJsonNull()) {
13655          res.getPreAuthRef().add(new StringType());
13656        } else {
13657          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
13658        }
13659      }
13660    }
13661    ;
13662    if (json.has("_preAuthRef")) {
13663      JsonArray array = json.getAsJsonArray("_preAuthRef");
13664      for (int i = 0; i < array.size(); i++) {
13665        if (i == res.getPreAuthRef().size())
13666          res.getPreAuthRef().add(parseString(null));
13667        if (array.get(i) instanceof JsonObject)
13668          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
13669      }
13670    }
13671    ;
13672  }
13673
13674  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json,
13675      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13676    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
13677    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
13678    return res;
13679  }
13680
13681  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13682      ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
13683    parseBackboneElementProperties(json, res);
13684    if (json.has("date"))
13685      res.setDateElement(parseDate(json.get("date").getAsString()));
13686    if (json.has("_date"))
13687      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13688    if (json.has("type"))
13689      res.setType(parseCodeableConcept(getJObject(json, "type")));
13690    Type location = parseType("location", json);
13691    if (location != null)
13692      res.setLocation(location);
13693  }
13694
13695  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json,
13696      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13697    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
13698    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
13699    return res;
13700  }
13701
13702  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13703      ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
13704    parseBackboneElementProperties(json, res);
13705    if (json.has("sequence"))
13706      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13707    if (json.has("_sequence"))
13708      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13709    if (json.has("careTeamSequence")) {
13710      JsonArray array = json.getAsJsonArray("careTeamSequence");
13711      for (int i = 0; i < array.size(); i++) {
13712        if (array.get(i).isJsonNull()) {
13713          res.getCareTeamSequence().add(new PositiveIntType());
13714        } else {
13715          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
13716        }
13717      }
13718    }
13719    ;
13720    if (json.has("_careTeamSequence")) {
13721      JsonArray array = json.getAsJsonArray("_careTeamSequence");
13722      for (int i = 0; i < array.size(); i++) {
13723        if (i == res.getCareTeamSequence().size())
13724          res.getCareTeamSequence().add(parsePositiveInt(null));
13725        if (array.get(i) instanceof JsonObject)
13726          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
13727      }
13728    }
13729    ;
13730    if (json.has("diagnosisSequence")) {
13731      JsonArray array = json.getAsJsonArray("diagnosisSequence");
13732      for (int i = 0; i < array.size(); i++) {
13733        if (array.get(i).isJsonNull()) {
13734          res.getDiagnosisSequence().add(new PositiveIntType());
13735        } else {
13736          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
13737        }
13738      }
13739    }
13740    ;
13741    if (json.has("_diagnosisSequence")) {
13742      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
13743      for (int i = 0; i < array.size(); i++) {
13744        if (i == res.getDiagnosisSequence().size())
13745          res.getDiagnosisSequence().add(parsePositiveInt(null));
13746        if (array.get(i) instanceof JsonObject)
13747          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
13748      }
13749    }
13750    ;
13751    if (json.has("procedureSequence")) {
13752      JsonArray array = json.getAsJsonArray("procedureSequence");
13753      for (int i = 0; i < array.size(); i++) {
13754        if (array.get(i).isJsonNull()) {
13755          res.getProcedureSequence().add(new PositiveIntType());
13756        } else {
13757          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
13758        }
13759      }
13760    }
13761    ;
13762    if (json.has("_procedureSequence")) {
13763      JsonArray array = json.getAsJsonArray("_procedureSequence");
13764      for (int i = 0; i < array.size(); i++) {
13765        if (i == res.getProcedureSequence().size())
13766          res.getProcedureSequence().add(parsePositiveInt(null));
13767        if (array.get(i) instanceof JsonObject)
13768          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
13769      }
13770    }
13771    ;
13772    if (json.has("informationSequence")) {
13773      JsonArray array = json.getAsJsonArray("informationSequence");
13774      for (int i = 0; i < array.size(); i++) {
13775        if (array.get(i).isJsonNull()) {
13776          res.getInformationSequence().add(new PositiveIntType());
13777        } else {
13778          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
13779        }
13780      }
13781    }
13782    ;
13783    if (json.has("_informationSequence")) {
13784      JsonArray array = json.getAsJsonArray("_informationSequence");
13785      for (int i = 0; i < array.size(); i++) {
13786        if (i == res.getInformationSequence().size())
13787          res.getInformationSequence().add(parsePositiveInt(null));
13788        if (array.get(i) instanceof JsonObject)
13789          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
13790      }
13791    }
13792    ;
13793    if (json.has("revenue"))
13794      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
13795    if (json.has("category"))
13796      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13797    if (json.has("productOrService"))
13798      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
13799    if (json.has("modifier")) {
13800      JsonArray array = json.getAsJsonArray("modifier");
13801      for (int i = 0; i < array.size(); i++) {
13802        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13803      }
13804    }
13805    ;
13806    if (json.has("programCode")) {
13807      JsonArray array = json.getAsJsonArray("programCode");
13808      for (int i = 0; i < array.size(); i++) {
13809        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13810      }
13811    }
13812    ;
13813    Type serviced = parseType("serviced", json);
13814    if (serviced != null)
13815      res.setServiced(serviced);
13816    Type location = parseType("location", json);
13817    if (location != null)
13818      res.setLocation(location);
13819    if (json.has("quantity"))
13820      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
13821    if (json.has("unitPrice"))
13822      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
13823    if (json.has("factor"))
13824      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13825    if (json.has("_factor"))
13826      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
13827    if (json.has("net"))
13828      res.setNet(parseMoney(getJObject(json, "net")));
13829    if (json.has("udi")) {
13830      JsonArray array = json.getAsJsonArray("udi");
13831      for (int i = 0; i < array.size(); i++) {
13832        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13833      }
13834    }
13835    ;
13836    if (json.has("bodySite"))
13837      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
13838    if (json.has("subSite")) {
13839      JsonArray array = json.getAsJsonArray("subSite");
13840      for (int i = 0; i < array.size(); i++) {
13841        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13842      }
13843    }
13844    ;
13845    if (json.has("encounter")) {
13846      JsonArray array = json.getAsJsonArray("encounter");
13847      for (int i = 0; i < array.size(); i++) {
13848        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
13849      }
13850    }
13851    ;
13852    if (json.has("noteNumber")) {
13853      JsonArray array = json.getAsJsonArray("noteNumber");
13854      for (int i = 0; i < array.size(); i++) {
13855        if (array.get(i).isJsonNull()) {
13856          res.getNoteNumber().add(new PositiveIntType());
13857        } else {
13858          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13859        }
13860      }
13861    }
13862    ;
13863    if (json.has("_noteNumber")) {
13864      JsonArray array = json.getAsJsonArray("_noteNumber");
13865      for (int i = 0; i < array.size(); i++) {
13866        if (i == res.getNoteNumber().size())
13867          res.getNoteNumber().add(parsePositiveInt(null));
13868        if (array.get(i) instanceof JsonObject)
13869          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13870      }
13871    }
13872    ;
13873    if (json.has("adjudication")) {
13874      JsonArray array = json.getAsJsonArray("adjudication");
13875      for (int i = 0; i < array.size(); i++) {
13876        res.getAdjudication()
13877            .add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13878      }
13879    }
13880    ;
13881    if (json.has("detail")) {
13882      JsonArray array = json.getAsJsonArray("detail");
13883      for (int i = 0; i < array.size(); i++) {
13884        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
13885      }
13886    }
13887    ;
13888  }
13889
13890  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json,
13891      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13892    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
13893    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
13894    return res;
13895  }
13896
13897  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13898      ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
13899    parseBackboneElementProperties(json, res);
13900    if (json.has("category"))
13901      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13902    if (json.has("reason"))
13903      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
13904    if (json.has("amount"))
13905      res.setAmount(parseMoney(getJObject(json, "amount")));
13906    if (json.has("value"))
13907      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
13908    if (json.has("_value"))
13909      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
13910  }
13911
13912  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json,
13913      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13914    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
13915    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
13916    return res;
13917  }
13918
13919  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner,
13920      ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
13921    parseBackboneElementProperties(json, res);
13922    if (json.has("sequence"))
13923      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13924    if (json.has("_sequence"))
13925      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
13926    if (json.has("revenue"))
13927      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
13928    if (json.has("category"))
13929      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
13930    if (json.has("productOrService"))
13931      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
13932    if (json.has("modifier")) {
13933      JsonArray array = json.getAsJsonArray("modifier");
13934      for (int i = 0; i < array.size(); i++) {
13935        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13936      }
13937    }
13938    ;
13939    if (json.has("programCode")) {
13940      JsonArray array = json.getAsJsonArray("programCode");
13941      for (int i = 0; i < array.size(); i++) {
13942        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13943      }
13944    }
13945    ;
13946    if (json.has("quantity"))
13947      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
13948    if (json.has("unitPrice"))
13949      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
13950    if (json.has("factor"))
13951      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13952    if (json.has("_factor"))
13953      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
13954    if (json.has("net"))
13955      res.setNet(parseMoney(getJObject(json, "net")));
13956    if (json.has("udi")) {
13957      JsonArray array = json.getAsJsonArray("udi");
13958      for (int i = 0; i < array.size(); i++) {
13959        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13960      }
13961    }
13962    ;
13963    if (json.has("noteNumber")) {
13964      JsonArray array = json.getAsJsonArray("noteNumber");
13965      for (int i = 0; i < array.size(); i++) {
13966        if (array.get(i).isJsonNull()) {
13967          res.getNoteNumber().add(new PositiveIntType());
13968        } else {
13969          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13970        }
13971      }
13972    }
13973    ;
13974    if (json.has("_noteNumber")) {
13975      JsonArray array = json.getAsJsonArray("_noteNumber");
13976      for (int i = 0; i < array.size(); i++) {
13977        if (i == res.getNoteNumber().size())
13978          res.getNoteNumber().add(parsePositiveInt(null));
13979        if (array.get(i) instanceof JsonObject)
13980          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13981      }
13982    }
13983    ;
13984    if (json.has("adjudication")) {
13985      JsonArray array = json.getAsJsonArray("adjudication");
13986      for (int i = 0; i < array.size(); i++) {
13987        res.getAdjudication()
13988            .add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13989      }
13990    }
13991    ;
13992    if (json.has("subDetail")) {
13993      JsonArray array = json.getAsJsonArray("subDetail");
13994      for (int i = 0; i < array.size(); i++) {
13995        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
13996      }
13997    }
13998    ;
13999  }
14000
14001  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json,
14002      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14003    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
14004    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
14005    return res;
14006  }
14007
14008  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner,
14009      ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
14010    parseBackboneElementProperties(json, res);
14011    if (json.has("sequence"))
14012      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
14013    if (json.has("_sequence"))
14014      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
14015    if (json.has("revenue"))
14016      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
14017    if (json.has("category"))
14018      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14019    if (json.has("productOrService"))
14020      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
14021    if (json.has("modifier")) {
14022      JsonArray array = json.getAsJsonArray("modifier");
14023      for (int i = 0; i < array.size(); i++) {
14024        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14025      }
14026    }
14027    ;
14028    if (json.has("programCode")) {
14029      JsonArray array = json.getAsJsonArray("programCode");
14030      for (int i = 0; i < array.size(); i++) {
14031        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14032      }
14033    }
14034    ;
14035    if (json.has("quantity"))
14036      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
14037    if (json.has("unitPrice"))
14038      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
14039    if (json.has("factor"))
14040      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14041    if (json.has("_factor"))
14042      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
14043    if (json.has("net"))
14044      res.setNet(parseMoney(getJObject(json, "net")));
14045    if (json.has("udi")) {
14046      JsonArray array = json.getAsJsonArray("udi");
14047      for (int i = 0; i < array.size(); i++) {
14048        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
14049      }
14050    }
14051    ;
14052    if (json.has("noteNumber")) {
14053      JsonArray array = json.getAsJsonArray("noteNumber");
14054      for (int i = 0; i < array.size(); i++) {
14055        if (array.get(i).isJsonNull()) {
14056          res.getNoteNumber().add(new PositiveIntType());
14057        } else {
14058          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
14059        }
14060      }
14061    }
14062    ;
14063    if (json.has("_noteNumber")) {
14064      JsonArray array = json.getAsJsonArray("_noteNumber");
14065      for (int i = 0; i < array.size(); i++) {
14066        if (i == res.getNoteNumber().size())
14067          res.getNoteNumber().add(parsePositiveInt(null));
14068        if (array.get(i) instanceof JsonObject)
14069          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
14070      }
14071    }
14072    ;
14073    if (json.has("adjudication")) {
14074      JsonArray array = json.getAsJsonArray("adjudication");
14075      for (int i = 0; i < array.size(); i++) {
14076        res.getAdjudication()
14077            .add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
14078      }
14079    }
14080    ;
14081  }
14082
14083  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json,
14084      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14085    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
14086    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
14087    return res;
14088  }
14089
14090  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner,
14091      ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
14092    parseBackboneElementProperties(json, res);
14093    if (json.has("itemSequence")) {
14094      JsonArray array = json.getAsJsonArray("itemSequence");
14095      for (int i = 0; i < array.size(); i++) {
14096        if (array.get(i).isJsonNull()) {
14097          res.getItemSequence().add(new PositiveIntType());
14098        } else {
14099          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
14100        }
14101      }
14102    }
14103    ;
14104    if (json.has("_itemSequence")) {
14105      JsonArray array = json.getAsJsonArray("_itemSequence");
14106      for (int i = 0; i < array.size(); i++) {
14107        if (i == res.getItemSequence().size())
14108          res.getItemSequence().add(parsePositiveInt(null));
14109        if (array.get(i) instanceof JsonObject)
14110          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
14111      }
14112    }
14113    ;
14114    if (json.has("detailSequence")) {
14115      JsonArray array = json.getAsJsonArray("detailSequence");
14116      for (int i = 0; i < array.size(); i++) {
14117        if (array.get(i).isJsonNull()) {
14118          res.getDetailSequence().add(new PositiveIntType());
14119        } else {
14120          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
14121        }
14122      }
14123    }
14124    ;
14125    if (json.has("_detailSequence")) {
14126      JsonArray array = json.getAsJsonArray("_detailSequence");
14127      for (int i = 0; i < array.size(); i++) {
14128        if (i == res.getDetailSequence().size())
14129          res.getDetailSequence().add(parsePositiveInt(null));
14130        if (array.get(i) instanceof JsonObject)
14131          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
14132      }
14133    }
14134    ;
14135    if (json.has("subDetailSequence")) {
14136      JsonArray array = json.getAsJsonArray("subDetailSequence");
14137      for (int i = 0; i < array.size(); i++) {
14138        if (array.get(i).isJsonNull()) {
14139          res.getSubDetailSequence().add(new PositiveIntType());
14140        } else {
14141          res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
14142        }
14143      }
14144    }
14145    ;
14146    if (json.has("_subDetailSequence")) {
14147      JsonArray array = json.getAsJsonArray("_subDetailSequence");
14148      for (int i = 0; i < array.size(); i++) {
14149        if (i == res.getSubDetailSequence().size())
14150          res.getSubDetailSequence().add(parsePositiveInt(null));
14151        if (array.get(i) instanceof JsonObject)
14152          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
14153      }
14154    }
14155    ;
14156    if (json.has("provider")) {
14157      JsonArray array = json.getAsJsonArray("provider");
14158      for (int i = 0; i < array.size(); i++) {
14159        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
14160      }
14161    }
14162    ;
14163    if (json.has("productOrService"))
14164      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
14165    if (json.has("modifier")) {
14166      JsonArray array = json.getAsJsonArray("modifier");
14167      for (int i = 0; i < array.size(); i++) {
14168        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14169      }
14170    }
14171    ;
14172    if (json.has("programCode")) {
14173      JsonArray array = json.getAsJsonArray("programCode");
14174      for (int i = 0; i < array.size(); i++) {
14175        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14176      }
14177    }
14178    ;
14179    Type serviced = parseType("serviced", json);
14180    if (serviced != null)
14181      res.setServiced(serviced);
14182    Type location = parseType("location", json);
14183    if (location != null)
14184      res.setLocation(location);
14185    if (json.has("quantity"))
14186      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
14187    if (json.has("unitPrice"))
14188      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
14189    if (json.has("factor"))
14190      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14191    if (json.has("_factor"))
14192      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
14193    if (json.has("net"))
14194      res.setNet(parseMoney(getJObject(json, "net")));
14195    if (json.has("bodySite"))
14196      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
14197    if (json.has("subSite")) {
14198      JsonArray array = json.getAsJsonArray("subSite");
14199      for (int i = 0; i < array.size(); i++) {
14200        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14201      }
14202    }
14203    ;
14204    if (json.has("noteNumber")) {
14205      JsonArray array = json.getAsJsonArray("noteNumber");
14206      for (int i = 0; i < array.size(); i++) {
14207        if (array.get(i).isJsonNull()) {
14208          res.getNoteNumber().add(new PositiveIntType());
14209        } else {
14210          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
14211        }
14212      }
14213    }
14214    ;
14215    if (json.has("_noteNumber")) {
14216      JsonArray array = json.getAsJsonArray("_noteNumber");
14217      for (int i = 0; i < array.size(); i++) {
14218        if (i == res.getNoteNumber().size())
14219          res.getNoteNumber().add(parsePositiveInt(null));
14220        if (array.get(i) instanceof JsonObject)
14221          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
14222      }
14223    }
14224    ;
14225    if (json.has("adjudication")) {
14226      JsonArray array = json.getAsJsonArray("adjudication");
14227      for (int i = 0; i < array.size(); i++) {
14228        res.getAdjudication()
14229            .add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
14230      }
14231    }
14232    ;
14233    if (json.has("detail")) {
14234      JsonArray array = json.getAsJsonArray("detail");
14235      for (int i = 0; i < array.size(); i++) {
14236        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
14237      }
14238    }
14239    ;
14240  }
14241
14242  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(
14243      JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14244    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
14245    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, owner, res);
14246    return res;
14247  }
14248
14249  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json,
14250      ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res)
14251      throws IOException, FHIRFormatError {
14252    parseBackboneElementProperties(json, res);
14253    if (json.has("productOrService"))
14254      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
14255    if (json.has("modifier")) {
14256      JsonArray array = json.getAsJsonArray("modifier");
14257      for (int i = 0; i < array.size(); i++) {
14258        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14259      }
14260    }
14261    ;
14262    if (json.has("quantity"))
14263      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
14264    if (json.has("unitPrice"))
14265      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
14266    if (json.has("factor"))
14267      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14268    if (json.has("_factor"))
14269      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
14270    if (json.has("net"))
14271      res.setNet(parseMoney(getJObject(json, "net")));
14272    if (json.has("noteNumber")) {
14273      JsonArray array = json.getAsJsonArray("noteNumber");
14274      for (int i = 0; i < array.size(); i++) {
14275        if (array.get(i).isJsonNull()) {
14276          res.getNoteNumber().add(new PositiveIntType());
14277        } else {
14278          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
14279        }
14280      }
14281    }
14282    ;
14283    if (json.has("_noteNumber")) {
14284      JsonArray array = json.getAsJsonArray("_noteNumber");
14285      for (int i = 0; i < array.size(); i++) {
14286        if (i == res.getNoteNumber().size())
14287          res.getNoteNumber().add(parsePositiveInt(null));
14288        if (array.get(i) instanceof JsonObject)
14289          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
14290      }
14291    }
14292    ;
14293    if (json.has("adjudication")) {
14294      JsonArray array = json.getAsJsonArray("adjudication");
14295      for (int i = 0; i < array.size(); i++) {
14296        res.getAdjudication()
14297            .add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
14298      }
14299    }
14300    ;
14301    if (json.has("subDetail")) {
14302      JsonArray array = json.getAsJsonArray("subDetail");
14303      for (int i = 0; i < array.size(); i++) {
14304        res.getSubDetail()
14305            .add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject(), owner));
14306      }
14307    }
14308    ;
14309  }
14310
14311  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(
14312      JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14313    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
14314    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, owner, res);
14315    return res;
14316  }
14317
14318  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json,
14319      ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res)
14320      throws IOException, FHIRFormatError {
14321    parseBackboneElementProperties(json, res);
14322    if (json.has("productOrService"))
14323      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
14324    if (json.has("modifier")) {
14325      JsonArray array = json.getAsJsonArray("modifier");
14326      for (int i = 0; i < array.size(); i++) {
14327        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14328      }
14329    }
14330    ;
14331    if (json.has("quantity"))
14332      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
14333    if (json.has("unitPrice"))
14334      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
14335    if (json.has("factor"))
14336      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14337    if (json.has("_factor"))
14338      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
14339    if (json.has("net"))
14340      res.setNet(parseMoney(getJObject(json, "net")));
14341    if (json.has("noteNumber")) {
14342      JsonArray array = json.getAsJsonArray("noteNumber");
14343      for (int i = 0; i < array.size(); i++) {
14344        if (array.get(i).isJsonNull()) {
14345          res.getNoteNumber().add(new PositiveIntType());
14346        } else {
14347          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
14348        }
14349      }
14350    }
14351    ;
14352    if (json.has("_noteNumber")) {
14353      JsonArray array = json.getAsJsonArray("_noteNumber");
14354      for (int i = 0; i < array.size(); i++) {
14355        if (i == res.getNoteNumber().size())
14356          res.getNoteNumber().add(parsePositiveInt(null));
14357        if (array.get(i) instanceof JsonObject)
14358          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
14359      }
14360    }
14361    ;
14362    if (json.has("adjudication")) {
14363      JsonArray array = json.getAsJsonArray("adjudication");
14364      for (int i = 0; i < array.size(); i++) {
14365        res.getAdjudication()
14366            .add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
14367      }
14368    }
14369    ;
14370  }
14371
14372  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json,
14373      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14374    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
14375    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
14376    return res;
14377  }
14378
14379  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner,
14380      ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
14381    parseBackboneElementProperties(json, res);
14382    if (json.has("category"))
14383      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14384    if (json.has("amount"))
14385      res.setAmount(parseMoney(getJObject(json, "amount")));
14386  }
14387
14388  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json,
14389      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14390    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
14391    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
14392    return res;
14393  }
14394
14395  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner,
14396      ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
14397    parseBackboneElementProperties(json, res);
14398    if (json.has("type"))
14399      res.setType(parseCodeableConcept(getJObject(json, "type")));
14400    if (json.has("adjustment"))
14401      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
14402    if (json.has("adjustmentReason"))
14403      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
14404    if (json.has("date"))
14405      res.setDateElement(parseDate(json.get("date").getAsString()));
14406    if (json.has("_date"))
14407      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14408    if (json.has("amount"))
14409      res.setAmount(parseMoney(getJObject(json, "amount")));
14410    if (json.has("identifier"))
14411      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
14412  }
14413
14414  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json,
14415      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14416    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
14417    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
14418    return res;
14419  }
14420
14421  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner,
14422      ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
14423    parseBackboneElementProperties(json, res);
14424    if (json.has("number"))
14425      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
14426    if (json.has("_number"))
14427      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
14428    if (json.has("type"))
14429      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL,
14430          new Enumerations.NoteTypeEnumFactory()));
14431    if (json.has("_type"))
14432      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14433    if (json.has("text"))
14434      res.setTextElement(parseString(json.get("text").getAsString()));
14435    if (json.has("_text"))
14436      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
14437    if (json.has("language"))
14438      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
14439  }
14440
14441  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(
14442      JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14443    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
14444    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
14445    return res;
14446  }
14447
14448  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner,
14449      ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
14450    parseBackboneElementProperties(json, res);
14451    if (json.has("category"))
14452      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14453    if (json.has("excluded"))
14454      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
14455    if (json.has("_excluded"))
14456      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
14457    if (json.has("name"))
14458      res.setNameElement(parseString(json.get("name").getAsString()));
14459    if (json.has("_name"))
14460      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14461    if (json.has("description"))
14462      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14463    if (json.has("_description"))
14464      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14465    if (json.has("network"))
14466      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
14467    if (json.has("unit"))
14468      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
14469    if (json.has("term"))
14470      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
14471    if (json.has("financial")) {
14472      JsonArray array = json.getAsJsonArray("financial");
14473      for (int i = 0; i < array.size(); i++) {
14474        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
14475      }
14476    }
14477    ;
14478  }
14479
14480  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json,
14481      ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
14482    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
14483    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
14484    return res;
14485  }
14486
14487  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner,
14488      ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
14489    parseBackboneElementProperties(json, res);
14490    if (json.has("type"))
14491      res.setType(parseCodeableConcept(getJObject(json, "type")));
14492    Type allowed = parseType("allowed", json);
14493    if (allowed != null)
14494      res.setAllowed(allowed);
14495    Type used = parseType("used", json);
14496    if (used != null)
14497      res.setUsed(used);
14498  }
14499
14500  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
14501    FamilyMemberHistory res = new FamilyMemberHistory();
14502    parseFamilyMemberHistoryProperties(json, res);
14503    return res;
14504  }
14505
14506  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res)
14507      throws IOException, FHIRFormatError {
14508    parseDomainResourceProperties(json, res);
14509    if (json.has("identifier")) {
14510      JsonArray array = json.getAsJsonArray("identifier");
14511      for (int i = 0; i < array.size(); i++) {
14512        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14513      }
14514    }
14515    ;
14516    if (json.has("instantiatesCanonical")) {
14517      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
14518      for (int i = 0; i < array.size(); i++) {
14519        if (array.get(i).isJsonNull()) {
14520          res.getInstantiatesCanonical().add(new CanonicalType());
14521        } else {
14522          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
14523        }
14524      }
14525    }
14526    ;
14527    if (json.has("_instantiatesCanonical")) {
14528      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
14529      for (int i = 0; i < array.size(); i++) {
14530        if (i == res.getInstantiatesCanonical().size())
14531          res.getInstantiatesCanonical().add(parseCanonical(null));
14532        if (array.get(i) instanceof JsonObject)
14533          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
14534      }
14535    }
14536    ;
14537    if (json.has("instantiatesUri")) {
14538      JsonArray array = json.getAsJsonArray("instantiatesUri");
14539      for (int i = 0; i < array.size(); i++) {
14540        if (array.get(i).isJsonNull()) {
14541          res.getInstantiatesUri().add(new UriType());
14542        } else {
14543          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
14544        }
14545      }
14546    }
14547    ;
14548    if (json.has("_instantiatesUri")) {
14549      JsonArray array = json.getAsJsonArray("_instantiatesUri");
14550      for (int i = 0; i < array.size(); i++) {
14551        if (i == res.getInstantiatesUri().size())
14552          res.getInstantiatesUri().add(parseUri(null));
14553        if (array.get(i) instanceof JsonObject)
14554          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
14555      }
14556    }
14557    ;
14558    if (json.has("status"))
14559      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
14560          FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
14561    if (json.has("_status"))
14562      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14563    if (json.has("dataAbsentReason"))
14564      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
14565    if (json.has("patient"))
14566      res.setPatient(parseReference(getJObject(json, "patient")));
14567    if (json.has("date"))
14568      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14569    if (json.has("_date"))
14570      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14571    if (json.has("name"))
14572      res.setNameElement(parseString(json.get("name").getAsString()));
14573    if (json.has("_name"))
14574      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14575    if (json.has("relationship"))
14576      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
14577    if (json.has("sex"))
14578      res.setSex(parseCodeableConcept(getJObject(json, "sex")));
14579    Type born = parseType("born", json);
14580    if (born != null)
14581      res.setBorn(born);
14582    Type age = parseType("age", json);
14583    if (age != null)
14584      res.setAge(age);
14585    if (json.has("estimatedAge"))
14586      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
14587    if (json.has("_estimatedAge"))
14588      parseElementProperties(getJObject(json, "_estimatedAge"), res.getEstimatedAgeElement());
14589    Type deceased = parseType("deceased", json);
14590    if (deceased != null)
14591      res.setDeceased(deceased);
14592    if (json.has("reasonCode")) {
14593      JsonArray array = json.getAsJsonArray("reasonCode");
14594      for (int i = 0; i < array.size(); i++) {
14595        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14596      }
14597    }
14598    ;
14599    if (json.has("reasonReference")) {
14600      JsonArray array = json.getAsJsonArray("reasonReference");
14601      for (int i = 0; i < array.size(); i++) {
14602        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14603      }
14604    }
14605    ;
14606    if (json.has("note")) {
14607      JsonArray array = json.getAsJsonArray("note");
14608      for (int i = 0; i < array.size(); i++) {
14609        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14610      }
14611    }
14612    ;
14613    if (json.has("condition")) {
14614      JsonArray array = json.getAsJsonArray("condition");
14615      for (int i = 0; i < array.size(); i++) {
14616        res.getCondition()
14617            .add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
14618      }
14619    }
14620    ;
14621  }
14622
14623  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(
14624      JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
14625    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
14626    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
14627    return res;
14628  }
14629
14630  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json,
14631      FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res)
14632      throws IOException, FHIRFormatError {
14633    parseBackboneElementProperties(json, res);
14634    if (json.has("code"))
14635      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14636    if (json.has("outcome"))
14637      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
14638    if (json.has("contributedToDeath"))
14639      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
14640    if (json.has("_contributedToDeath"))
14641      parseElementProperties(getJObject(json, "_contributedToDeath"), res.getContributedToDeathElement());
14642    Type onset = parseType("onset", json);
14643    if (onset != null)
14644      res.setOnset(onset);
14645    if (json.has("note")) {
14646      JsonArray array = json.getAsJsonArray("note");
14647      for (int i = 0; i < array.size(); i++) {
14648        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14649      }
14650    }
14651    ;
14652  }
14653
14654  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
14655    Flag res = new Flag();
14656    parseFlagProperties(json, res);
14657    return res;
14658  }
14659
14660  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
14661    parseDomainResourceProperties(json, res);
14662    if (json.has("identifier")) {
14663      JsonArray array = json.getAsJsonArray("identifier");
14664      for (int i = 0; i < array.size(); i++) {
14665        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14666      }
14667    }
14668    ;
14669    if (json.has("status"))
14670      res.setStatusElement(
14671          parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
14672    if (json.has("_status"))
14673      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14674    if (json.has("category")) {
14675      JsonArray array = json.getAsJsonArray("category");
14676      for (int i = 0; i < array.size(); i++) {
14677        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14678      }
14679    }
14680    ;
14681    if (json.has("code"))
14682      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14683    if (json.has("subject"))
14684      res.setSubject(parseReference(getJObject(json, "subject")));
14685    if (json.has("period"))
14686      res.setPeriod(parsePeriod(getJObject(json, "period")));
14687    if (json.has("encounter"))
14688      res.setEncounter(parseReference(getJObject(json, "encounter")));
14689    if (json.has("author"))
14690      res.setAuthor(parseReference(getJObject(json, "author")));
14691  }
14692
14693  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
14694    Goal res = new Goal();
14695    parseGoalProperties(json, res);
14696    return res;
14697  }
14698
14699  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
14700    parseDomainResourceProperties(json, res);
14701    if (json.has("identifier")) {
14702      JsonArray array = json.getAsJsonArray("identifier");
14703      for (int i = 0; i < array.size(); i++) {
14704        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14705      }
14706    }
14707    ;
14708    if (json.has("lifecycleStatus"))
14709      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(),
14710          Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
14711    if (json.has("_lifecycleStatus"))
14712      parseElementProperties(getJObject(json, "_lifecycleStatus"), res.getLifecycleStatusElement());
14713    if (json.has("achievementStatus"))
14714      res.setAchievementStatus(parseCodeableConcept(getJObject(json, "achievementStatus")));
14715    if (json.has("category")) {
14716      JsonArray array = json.getAsJsonArray("category");
14717      for (int i = 0; i < array.size(); i++) {
14718        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14719      }
14720    }
14721    ;
14722    if (json.has("priority"))
14723      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
14724    if (json.has("description"))
14725      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
14726    if (json.has("subject"))
14727      res.setSubject(parseReference(getJObject(json, "subject")));
14728    Type start = parseType("start", json);
14729    if (start != null)
14730      res.setStart(start);
14731    if (json.has("target")) {
14732      JsonArray array = json.getAsJsonArray("target");
14733      for (int i = 0; i < array.size(); i++) {
14734        res.getTarget().add(parseGoalGoalTargetComponent(array.get(i).getAsJsonObject(), res));
14735      }
14736    }
14737    ;
14738    if (json.has("statusDate"))
14739      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
14740    if (json.has("_statusDate"))
14741      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
14742    if (json.has("statusReason"))
14743      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
14744    if (json.has("_statusReason"))
14745      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
14746    if (json.has("expressedBy"))
14747      res.setExpressedBy(parseReference(getJObject(json, "expressedBy")));
14748    if (json.has("addresses")) {
14749      JsonArray array = json.getAsJsonArray("addresses");
14750      for (int i = 0; i < array.size(); i++) {
14751        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
14752      }
14753    }
14754    ;
14755    if (json.has("note")) {
14756      JsonArray array = json.getAsJsonArray("note");
14757      for (int i = 0; i < array.size(); i++) {
14758        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14759      }
14760    }
14761    ;
14762    if (json.has("outcomeCode")) {
14763      JsonArray array = json.getAsJsonArray("outcomeCode");
14764      for (int i = 0; i < array.size(); i++) {
14765        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14766      }
14767    }
14768    ;
14769    if (json.has("outcomeReference")) {
14770      JsonArray array = json.getAsJsonArray("outcomeReference");
14771      for (int i = 0; i < array.size(); i++) {
14772        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
14773      }
14774    }
14775    ;
14776  }
14777
14778  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner)
14779      throws IOException, FHIRFormatError {
14780    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
14781    parseGoalGoalTargetComponentProperties(json, owner, res);
14782    return res;
14783  }
14784
14785  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res)
14786      throws IOException, FHIRFormatError {
14787    parseBackboneElementProperties(json, res);
14788    if (json.has("measure"))
14789      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
14790    Type detail = parseType("detail", json);
14791    if (detail != null)
14792      res.setDetail(detail);
14793    Type due = parseType("due", json);
14794    if (due != null)
14795      res.setDue(due);
14796  }
14797
14798  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
14799    GraphDefinition res = new GraphDefinition();
14800    parseGraphDefinitionProperties(json, res);
14801    return res;
14802  }
14803
14804  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res)
14805      throws IOException, FHIRFormatError {
14806    parseDomainResourceProperties(json, res);
14807    if (json.has("url"))
14808      res.setUrlElement(parseUri(json.get("url").getAsString()));
14809    if (json.has("_url"))
14810      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14811    if (json.has("version"))
14812      res.setVersionElement(parseString(json.get("version").getAsString()));
14813    if (json.has("_version"))
14814      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14815    if (json.has("name"))
14816      res.setNameElement(parseString(json.get("name").getAsString()));
14817    if (json.has("_name"))
14818      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14819    if (json.has("status"))
14820      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
14821          new Enumerations.PublicationStatusEnumFactory()));
14822    if (json.has("_status"))
14823      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14824    if (json.has("experimental"))
14825      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14826    if (json.has("_experimental"))
14827      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
14828    if (json.has("date"))
14829      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14830    if (json.has("_date"))
14831      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14832    if (json.has("publisher"))
14833      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14834    if (json.has("_publisher"))
14835      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14836    if (json.has("contact")) {
14837      JsonArray array = json.getAsJsonArray("contact");
14838      for (int i = 0; i < array.size(); i++) {
14839        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14840      }
14841    }
14842    ;
14843    if (json.has("description"))
14844      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14845    if (json.has("_description"))
14846      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14847    if (json.has("useContext")) {
14848      JsonArray array = json.getAsJsonArray("useContext");
14849      for (int i = 0; i < array.size(); i++) {
14850        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14851      }
14852    }
14853    ;
14854    if (json.has("jurisdiction")) {
14855      JsonArray array = json.getAsJsonArray("jurisdiction");
14856      for (int i = 0; i < array.size(); i++) {
14857        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14858      }
14859    }
14860    ;
14861    if (json.has("purpose"))
14862      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14863    if (json.has("_purpose"))
14864      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
14865    if (json.has("start"))
14866      res.setStartElement(parseCode(json.get("start").getAsString()));
14867    if (json.has("_start"))
14868      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
14869    if (json.has("profile"))
14870      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14871    if (json.has("_profile"))
14872      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
14873    if (json.has("link")) {
14874      JsonArray array = json.getAsJsonArray("link");
14875      for (int i = 0; i < array.size(); i++) {
14876        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
14877      }
14878    }
14879    ;
14880  }
14881
14882  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(
14883      JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
14884    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
14885    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
14886    return res;
14887  }
14888
14889  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner,
14890      GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
14891    parseBackboneElementProperties(json, res);
14892    if (json.has("path"))
14893      res.setPathElement(parseString(json.get("path").getAsString()));
14894    if (json.has("_path"))
14895      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
14896    if (json.has("sliceName"))
14897      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
14898    if (json.has("_sliceName"))
14899      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
14900    if (json.has("min"))
14901      res.setMinElement(parseInteger(json.get("min").getAsLong()));
14902    if (json.has("_min"))
14903      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
14904    if (json.has("max"))
14905      res.setMaxElement(parseString(json.get("max").getAsString()));
14906    if (json.has("_max"))
14907      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
14908    if (json.has("description"))
14909      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14910    if (json.has("_description"))
14911      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14912    if (json.has("target")) {
14913      JsonArray array = json.getAsJsonArray("target");
14914      for (int i = 0; i < array.size(); i++) {
14915        res.getTarget()
14916            .add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
14917      }
14918    }
14919    ;
14920  }
14921
14922  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(
14923      JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
14924    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
14925    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
14926    return res;
14927  }
14928
14929  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json,
14930      GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res)
14931      throws IOException, FHIRFormatError {
14932    parseBackboneElementProperties(json, res);
14933    if (json.has("type"))
14934      res.setTypeElement(parseCode(json.get("type").getAsString()));
14935    if (json.has("_type"))
14936      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14937    if (json.has("params"))
14938      res.setParamsElement(parseString(json.get("params").getAsString()));
14939    if (json.has("_params"))
14940      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
14941    if (json.has("profile"))
14942      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14943    if (json.has("_profile"))
14944      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
14945    if (json.has("compartment")) {
14946      JsonArray array = json.getAsJsonArray("compartment");
14947      for (int i = 0; i < array.size(); i++) {
14948        res.getCompartment().add(
14949            parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
14950      }
14951    }
14952    ;
14953    if (json.has("link")) {
14954      JsonArray array = json.getAsJsonArray("link");
14955      for (int i = 0; i < array.size(); i++) {
14956        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
14957      }
14958    }
14959    ;
14960  }
14961
14962  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(
14963      JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
14964    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
14965    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
14966    return res;
14967  }
14968
14969  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json,
14970      GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res)
14971      throws IOException, FHIRFormatError {
14972    parseBackboneElementProperties(json, res);
14973    if (json.has("use"))
14974      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL,
14975          new GraphDefinition.GraphCompartmentUseEnumFactory()));
14976    if (json.has("_use"))
14977      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
14978    if (json.has("code"))
14979      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL,
14980          new GraphDefinition.CompartmentCodeEnumFactory()));
14981    if (json.has("_code"))
14982      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
14983    if (json.has("rule"))
14984      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL,
14985          new GraphDefinition.GraphCompartmentRuleEnumFactory()));
14986    if (json.has("_rule"))
14987      parseElementProperties(getJObject(json, "_rule"), res.getRuleElement());
14988    if (json.has("expression"))
14989      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14990    if (json.has("_expression"))
14991      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
14992    if (json.has("description"))
14993      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14994    if (json.has("_description"))
14995      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14996  }
14997
14998  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
14999    Group res = new Group();
15000    parseGroupProperties(json, res);
15001    return res;
15002  }
15003
15004  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
15005    parseDomainResourceProperties(json, res);
15006    if (json.has("identifier")) {
15007      JsonArray array = json.getAsJsonArray("identifier");
15008      for (int i = 0; i < array.size(); i++) {
15009        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15010      }
15011    }
15012    ;
15013    if (json.has("active"))
15014      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
15015    if (json.has("_active"))
15016      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
15017    if (json.has("type"))
15018      res.setTypeElement(
15019          parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
15020    if (json.has("_type"))
15021      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15022    if (json.has("actual"))
15023      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
15024    if (json.has("_actual"))
15025      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
15026    if (json.has("code"))
15027      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15028    if (json.has("name"))
15029      res.setNameElement(parseString(json.get("name").getAsString()));
15030    if (json.has("_name"))
15031      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15032    if (json.has("quantity"))
15033      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
15034    if (json.has("_quantity"))
15035      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
15036    if (json.has("managingEntity"))
15037      res.setManagingEntity(parseReference(getJObject(json, "managingEntity")));
15038    if (json.has("characteristic")) {
15039      JsonArray array = json.getAsJsonArray("characteristic");
15040      for (int i = 0; i < array.size(); i++) {
15041        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
15042      }
15043    }
15044    ;
15045    if (json.has("member")) {
15046      JsonArray array = json.getAsJsonArray("member");
15047      for (int i = 0; i < array.size(); i++) {
15048        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
15049      }
15050    }
15051    ;
15052  }
15053
15054  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner)
15055      throws IOException, FHIRFormatError {
15056    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
15057    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
15058    return res;
15059  }
15060
15061  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner,
15062      Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
15063    parseBackboneElementProperties(json, res);
15064    if (json.has("code"))
15065      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15066    Type value = parseType("value", json);
15067    if (value != null)
15068      res.setValue(value);
15069    if (json.has("exclude"))
15070      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
15071    if (json.has("_exclude"))
15072      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
15073    if (json.has("period"))
15074      res.setPeriod(parsePeriod(getJObject(json, "period")));
15075  }
15076
15077  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner)
15078      throws IOException, FHIRFormatError {
15079    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
15080    parseGroupGroupMemberComponentProperties(json, owner, res);
15081    return res;
15082  }
15083
15084  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res)
15085      throws IOException, FHIRFormatError {
15086    parseBackboneElementProperties(json, res);
15087    if (json.has("entity"))
15088      res.setEntity(parseReference(getJObject(json, "entity")));
15089    if (json.has("period"))
15090      res.setPeriod(parsePeriod(getJObject(json, "period")));
15091    if (json.has("inactive"))
15092      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
15093    if (json.has("_inactive"))
15094      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
15095  }
15096
15097  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
15098    GuidanceResponse res = new GuidanceResponse();
15099    parseGuidanceResponseProperties(json, res);
15100    return res;
15101  }
15102
15103  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res)
15104      throws IOException, FHIRFormatError {
15105    parseDomainResourceProperties(json, res);
15106    if (json.has("requestIdentifier"))
15107      res.setRequestIdentifier(parseIdentifier(getJObject(json, "requestIdentifier")));
15108    if (json.has("identifier")) {
15109      JsonArray array = json.getAsJsonArray("identifier");
15110      for (int i = 0; i < array.size(); i++) {
15111        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15112      }
15113    }
15114    ;
15115    Type module = parseType("module", json);
15116    if (module != null)
15117      res.setModule(module);
15118    if (json.has("status"))
15119      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
15120          GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
15121    if (json.has("_status"))
15122      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15123    if (json.has("subject"))
15124      res.setSubject(parseReference(getJObject(json, "subject")));
15125    if (json.has("encounter"))
15126      res.setEncounter(parseReference(getJObject(json, "encounter")));
15127    if (json.has("occurrenceDateTime"))
15128      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
15129    if (json.has("_occurrenceDateTime"))
15130      parseElementProperties(getJObject(json, "_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
15131    if (json.has("performer"))
15132      res.setPerformer(parseReference(getJObject(json, "performer")));
15133    if (json.has("reasonCode")) {
15134      JsonArray array = json.getAsJsonArray("reasonCode");
15135      for (int i = 0; i < array.size(); i++) {
15136        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15137      }
15138    }
15139    ;
15140    if (json.has("reasonReference")) {
15141      JsonArray array = json.getAsJsonArray("reasonReference");
15142      for (int i = 0; i < array.size(); i++) {
15143        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15144      }
15145    }
15146    ;
15147    if (json.has("note")) {
15148      JsonArray array = json.getAsJsonArray("note");
15149      for (int i = 0; i < array.size(); i++) {
15150        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15151      }
15152    }
15153    ;
15154    if (json.has("evaluationMessage")) {
15155      JsonArray array = json.getAsJsonArray("evaluationMessage");
15156      for (int i = 0; i < array.size(); i++) {
15157        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
15158      }
15159    }
15160    ;
15161    if (json.has("outputParameters"))
15162      res.setOutputParameters(parseReference(getJObject(json, "outputParameters")));
15163    if (json.has("result"))
15164      res.setResult(parseReference(getJObject(json, "result")));
15165    if (json.has("dataRequirement")) {
15166      JsonArray array = json.getAsJsonArray("dataRequirement");
15167      for (int i = 0; i < array.size(); i++) {
15168        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
15169      }
15170    }
15171    ;
15172  }
15173
15174  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
15175    HealthcareService res = new HealthcareService();
15176    parseHealthcareServiceProperties(json, res);
15177    return res;
15178  }
15179
15180  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res)
15181      throws IOException, FHIRFormatError {
15182    parseDomainResourceProperties(json, res);
15183    if (json.has("identifier")) {
15184      JsonArray array = json.getAsJsonArray("identifier");
15185      for (int i = 0; i < array.size(); i++) {
15186        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15187      }
15188    }
15189    ;
15190    if (json.has("active"))
15191      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
15192    if (json.has("_active"))
15193      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
15194    if (json.has("providedBy"))
15195      res.setProvidedBy(parseReference(getJObject(json, "providedBy")));
15196    if (json.has("category")) {
15197      JsonArray array = json.getAsJsonArray("category");
15198      for (int i = 0; i < array.size(); i++) {
15199        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15200      }
15201    }
15202    ;
15203    if (json.has("type")) {
15204      JsonArray array = json.getAsJsonArray("type");
15205      for (int i = 0; i < array.size(); i++) {
15206        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15207      }
15208    }
15209    ;
15210    if (json.has("specialty")) {
15211      JsonArray array = json.getAsJsonArray("specialty");
15212      for (int i = 0; i < array.size(); i++) {
15213        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15214      }
15215    }
15216    ;
15217    if (json.has("location")) {
15218      JsonArray array = json.getAsJsonArray("location");
15219      for (int i = 0; i < array.size(); i++) {
15220        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
15221      }
15222    }
15223    ;
15224    if (json.has("name"))
15225      res.setNameElement(parseString(json.get("name").getAsString()));
15226    if (json.has("_name"))
15227      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15228    if (json.has("comment"))
15229      res.setCommentElement(parseString(json.get("comment").getAsString()));
15230    if (json.has("_comment"))
15231      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
15232    if (json.has("extraDetails"))
15233      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
15234    if (json.has("_extraDetails"))
15235      parseElementProperties(getJObject(json, "_extraDetails"), res.getExtraDetailsElement());
15236    if (json.has("photo"))
15237      res.setPhoto(parseAttachment(getJObject(json, "photo")));
15238    if (json.has("telecom")) {
15239      JsonArray array = json.getAsJsonArray("telecom");
15240      for (int i = 0; i < array.size(); i++) {
15241        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15242      }
15243    }
15244    ;
15245    if (json.has("coverageArea")) {
15246      JsonArray array = json.getAsJsonArray("coverageArea");
15247      for (int i = 0; i < array.size(); i++) {
15248        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
15249      }
15250    }
15251    ;
15252    if (json.has("serviceProvisionCode")) {
15253      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
15254      for (int i = 0; i < array.size(); i++) {
15255        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15256      }
15257    }
15258    ;
15259    if (json.has("eligibility")) {
15260      JsonArray array = json.getAsJsonArray("eligibility");
15261      for (int i = 0; i < array.size(); i++) {
15262        res.getEligibility()
15263            .add(parseHealthcareServiceHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject(), res));
15264      }
15265    }
15266    ;
15267    if (json.has("program")) {
15268      JsonArray array = json.getAsJsonArray("program");
15269      for (int i = 0; i < array.size(); i++) {
15270        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15271      }
15272    }
15273    ;
15274    if (json.has("characteristic")) {
15275      JsonArray array = json.getAsJsonArray("characteristic");
15276      for (int i = 0; i < array.size(); i++) {
15277        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15278      }
15279    }
15280    ;
15281    if (json.has("communication")) {
15282      JsonArray array = json.getAsJsonArray("communication");
15283      for (int i = 0; i < array.size(); i++) {
15284        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15285      }
15286    }
15287    ;
15288    if (json.has("referralMethod")) {
15289      JsonArray array = json.getAsJsonArray("referralMethod");
15290      for (int i = 0; i < array.size(); i++) {
15291        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15292      }
15293    }
15294    ;
15295    if (json.has("appointmentRequired"))
15296      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
15297    if (json.has("_appointmentRequired"))
15298      parseElementProperties(getJObject(json, "_appointmentRequired"), res.getAppointmentRequiredElement());
15299    if (json.has("availableTime")) {
15300      JsonArray array = json.getAsJsonArray("availableTime");
15301      for (int i = 0; i < array.size(); i++) {
15302        res.getAvailableTime()
15303            .add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
15304      }
15305    }
15306    ;
15307    if (json.has("notAvailable")) {
15308      JsonArray array = json.getAsJsonArray("notAvailable");
15309      for (int i = 0; i < array.size(); i++) {
15310        res.getNotAvailable()
15311            .add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
15312      }
15313    }
15314    ;
15315    if (json.has("availabilityExceptions"))
15316      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
15317    if (json.has("_availabilityExceptions"))
15318      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
15319    if (json.has("endpoint")) {
15320      JsonArray array = json.getAsJsonArray("endpoint");
15321      for (int i = 0; i < array.size(); i++) {
15322        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15323      }
15324    }
15325    ;
15326  }
15327
15328  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceHealthcareServiceEligibilityComponent(
15329      JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
15330    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
15331    parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(json, owner, res);
15332    return res;
15333  }
15334
15335  protected void parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(JsonObject json,
15336      HealthcareService owner, HealthcareService.HealthcareServiceEligibilityComponent res)
15337      throws IOException, FHIRFormatError {
15338    parseBackboneElementProperties(json, res);
15339    if (json.has("code"))
15340      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15341    if (json.has("comment"))
15342      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
15343    if (json.has("_comment"))
15344      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
15345  }
15346
15347  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(
15348      JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
15349    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
15350    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
15351    return res;
15352  }
15353
15354  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json,
15355      HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res)
15356      throws IOException, FHIRFormatError {
15357    parseBackboneElementProperties(json, res);
15358    if (json.has("daysOfWeek")) {
15359      JsonArray array = json.getAsJsonArray("daysOfWeek");
15360      for (int i = 0; i < array.size(); i++) {
15361        if (array.get(i).isJsonNull()) {
15362          res.getDaysOfWeek().add(new Enumeration<HealthcareService.DaysOfWeek>());
15363        } else {
15364          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL,
15365              new HealthcareService.DaysOfWeekEnumFactory()));
15366        }
15367      }
15368    }
15369    ;
15370    if (json.has("_daysOfWeek")) {
15371      JsonArray array = json.getAsJsonArray("_daysOfWeek");
15372      for (int i = 0; i < array.size(); i++) {
15373        if (i == res.getDaysOfWeek().size())
15374          res.getDaysOfWeek().add(
15375              parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
15376        if (array.get(i) instanceof JsonObject)
15377          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
15378      }
15379    }
15380    ;
15381    if (json.has("allDay"))
15382      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
15383    if (json.has("_allDay"))
15384      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
15385    if (json.has("availableStartTime"))
15386      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
15387    if (json.has("_availableStartTime"))
15388      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
15389    if (json.has("availableEndTime"))
15390      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
15391    if (json.has("_availableEndTime"))
15392      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
15393  }
15394
15395  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(
15396      JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
15397    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
15398    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
15399    return res;
15400  }
15401
15402  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json,
15403      HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res)
15404      throws IOException, FHIRFormatError {
15405    parseBackboneElementProperties(json, res);
15406    if (json.has("description"))
15407      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15408    if (json.has("_description"))
15409      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15410    if (json.has("during"))
15411      res.setDuring(parsePeriod(getJObject(json, "during")));
15412  }
15413
15414  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
15415    ImagingStudy res = new ImagingStudy();
15416    parseImagingStudyProperties(json, res);
15417    return res;
15418  }
15419
15420  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
15421    parseDomainResourceProperties(json, res);
15422    if (json.has("identifier")) {
15423      JsonArray array = json.getAsJsonArray("identifier");
15424      for (int i = 0; i < array.size(); i++) {
15425        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15426      }
15427    }
15428    ;
15429    if (json.has("status"))
15430      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL,
15431          new ImagingStudy.ImagingStudyStatusEnumFactory()));
15432    if (json.has("_status"))
15433      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15434    if (json.has("modality")) {
15435      JsonArray array = json.getAsJsonArray("modality");
15436      for (int i = 0; i < array.size(); i++) {
15437        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
15438      }
15439    }
15440    ;
15441    if (json.has("subject"))
15442      res.setSubject(parseReference(getJObject(json, "subject")));
15443    if (json.has("encounter"))
15444      res.setEncounter(parseReference(getJObject(json, "encounter")));
15445    if (json.has("started"))
15446      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
15447    if (json.has("_started"))
15448      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
15449    if (json.has("basedOn")) {
15450      JsonArray array = json.getAsJsonArray("basedOn");
15451      for (int i = 0; i < array.size(); i++) {
15452        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15453      }
15454    }
15455    ;
15456    if (json.has("referrer"))
15457      res.setReferrer(parseReference(getJObject(json, "referrer")));
15458    if (json.has("interpreter")) {
15459      JsonArray array = json.getAsJsonArray("interpreter");
15460      for (int i = 0; i < array.size(); i++) {
15461        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
15462      }
15463    }
15464    ;
15465    if (json.has("endpoint")) {
15466      JsonArray array = json.getAsJsonArray("endpoint");
15467      for (int i = 0; i < array.size(); i++) {
15468        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15469      }
15470    }
15471    ;
15472    if (json.has("numberOfSeries"))
15473      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
15474    if (json.has("_numberOfSeries"))
15475      parseElementProperties(getJObject(json, "_numberOfSeries"), res.getNumberOfSeriesElement());
15476    if (json.has("numberOfInstances"))
15477      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
15478    if (json.has("_numberOfInstances"))
15479      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
15480    if (json.has("procedureReference"))
15481      res.setProcedureReference(parseReference(getJObject(json, "procedureReference")));
15482    if (json.has("procedureCode")) {
15483      JsonArray array = json.getAsJsonArray("procedureCode");
15484      for (int i = 0; i < array.size(); i++) {
15485        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15486      }
15487    }
15488    ;
15489    if (json.has("location"))
15490      res.setLocation(parseReference(getJObject(json, "location")));
15491    if (json.has("reasonCode")) {
15492      JsonArray array = json.getAsJsonArray("reasonCode");
15493      for (int i = 0; i < array.size(); i++) {
15494        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15495      }
15496    }
15497    ;
15498    if (json.has("reasonReference")) {
15499      JsonArray array = json.getAsJsonArray("reasonReference");
15500      for (int i = 0; i < array.size(); i++) {
15501        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15502      }
15503    }
15504    ;
15505    if (json.has("note")) {
15506      JsonArray array = json.getAsJsonArray("note");
15507      for (int i = 0; i < array.size(); i++) {
15508        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15509      }
15510    }
15511    ;
15512    if (json.has("description"))
15513      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15514    if (json.has("_description"))
15515      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15516    if (json.has("series")) {
15517      JsonArray array = json.getAsJsonArray("series");
15518      for (int i = 0; i < array.size(); i++) {
15519        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
15520      }
15521    }
15522    ;
15523  }
15524
15525  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json,
15526      ImagingStudy owner) throws IOException, FHIRFormatError {
15527    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
15528    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
15529    return res;
15530  }
15531
15532  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner,
15533      ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
15534    parseBackboneElementProperties(json, res);
15535    if (json.has("uid"))
15536      res.setUidElement(parseId(json.get("uid").getAsString()));
15537    if (json.has("_uid"))
15538      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
15539    if (json.has("number"))
15540      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
15541    if (json.has("_number"))
15542      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
15543    if (json.has("modality"))
15544      res.setModality(parseCoding(getJObject(json, "modality")));
15545    if (json.has("description"))
15546      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15547    if (json.has("_description"))
15548      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15549    if (json.has("numberOfInstances"))
15550      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
15551    if (json.has("_numberOfInstances"))
15552      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
15553    if (json.has("endpoint")) {
15554      JsonArray array = json.getAsJsonArray("endpoint");
15555      for (int i = 0; i < array.size(); i++) {
15556        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15557      }
15558    }
15559    ;
15560    if (json.has("bodySite"))
15561      res.setBodySite(parseCoding(getJObject(json, "bodySite")));
15562    if (json.has("laterality"))
15563      res.setLaterality(parseCoding(getJObject(json, "laterality")));
15564    if (json.has("specimen")) {
15565      JsonArray array = json.getAsJsonArray("specimen");
15566      for (int i = 0; i < array.size(); i++) {
15567        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
15568      }
15569    }
15570    ;
15571    if (json.has("started"))
15572      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
15573    if (json.has("_started"))
15574      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
15575    if (json.has("performer")) {
15576      JsonArray array = json.getAsJsonArray("performer");
15577      for (int i = 0; i < array.size(); i++) {
15578        res.getPerformer()
15579            .add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
15580      }
15581    }
15582    ;
15583    if (json.has("instance")) {
15584      JsonArray array = json.getAsJsonArray("instance");
15585      for (int i = 0; i < array.size(); i++) {
15586        res.getInstance()
15587            .add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
15588      }
15589    }
15590    ;
15591  }
15592
15593  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(
15594      JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
15595    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
15596    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
15597    return res;
15598  }
15599
15600  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner,
15601      ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
15602    parseBackboneElementProperties(json, res);
15603    if (json.has("function"))
15604      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
15605    if (json.has("actor"))
15606      res.setActor(parseReference(getJObject(json, "actor")));
15607  }
15608
15609  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(
15610      JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
15611    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
15612    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
15613    return res;
15614  }
15615
15616  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner,
15617      ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
15618    parseBackboneElementProperties(json, res);
15619    if (json.has("uid"))
15620      res.setUidElement(parseId(json.get("uid").getAsString()));
15621    if (json.has("_uid"))
15622      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
15623    if (json.has("sopClass"))
15624      res.setSopClass(parseCoding(getJObject(json, "sopClass")));
15625    if (json.has("number"))
15626      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
15627    if (json.has("_number"))
15628      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
15629    if (json.has("title"))
15630      res.setTitleElement(parseString(json.get("title").getAsString()));
15631    if (json.has("_title"))
15632      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15633  }
15634
15635  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
15636    Immunization res = new Immunization();
15637    parseImmunizationProperties(json, res);
15638    return res;
15639  }
15640
15641  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
15642    parseDomainResourceProperties(json, res);
15643    if (json.has("identifier")) {
15644      JsonArray array = json.getAsJsonArray("identifier");
15645      for (int i = 0; i < array.size(); i++) {
15646        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15647      }
15648    }
15649    ;
15650    if (json.has("status"))
15651      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL,
15652          new Immunization.ImmunizationStatusEnumFactory()));
15653    if (json.has("_status"))
15654      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15655    if (json.has("statusReason"))
15656      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
15657    if (json.has("vaccineCode"))
15658      res.setVaccineCode(parseCodeableConcept(getJObject(json, "vaccineCode")));
15659    if (json.has("patient"))
15660      res.setPatient(parseReference(getJObject(json, "patient")));
15661    if (json.has("encounter"))
15662      res.setEncounter(parseReference(getJObject(json, "encounter")));
15663    Type occurrence = parseType("occurrence", json);
15664    if (occurrence != null)
15665      res.setOccurrence(occurrence);
15666    if (json.has("recorded"))
15667      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
15668    if (json.has("_recorded"))
15669      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
15670    if (json.has("primarySource"))
15671      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
15672    if (json.has("_primarySource"))
15673      parseElementProperties(getJObject(json, "_primarySource"), res.getPrimarySourceElement());
15674    if (json.has("reportOrigin"))
15675      res.setReportOrigin(parseCodeableConcept(getJObject(json, "reportOrigin")));
15676    if (json.has("location"))
15677      res.setLocation(parseReference(getJObject(json, "location")));
15678    if (json.has("manufacturer"))
15679      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
15680    if (json.has("lotNumber"))
15681      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
15682    if (json.has("_lotNumber"))
15683      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
15684    if (json.has("expirationDate"))
15685      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
15686    if (json.has("_expirationDate"))
15687      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
15688    if (json.has("site"))
15689      res.setSite(parseCodeableConcept(getJObject(json, "site")));
15690    if (json.has("route"))
15691      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
15692    if (json.has("doseQuantity"))
15693      res.setDoseQuantity(parseQuantity(getJObject(json, "doseQuantity")));
15694    if (json.has("performer")) {
15695      JsonArray array = json.getAsJsonArray("performer");
15696      for (int i = 0; i < array.size(); i++) {
15697        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
15698      }
15699    }
15700    ;
15701    if (json.has("note")) {
15702      JsonArray array = json.getAsJsonArray("note");
15703      for (int i = 0; i < array.size(); i++) {
15704        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15705      }
15706    }
15707    ;
15708    if (json.has("reasonCode")) {
15709      JsonArray array = json.getAsJsonArray("reasonCode");
15710      for (int i = 0; i < array.size(); i++) {
15711        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15712      }
15713    }
15714    ;
15715    if (json.has("reasonReference")) {
15716      JsonArray array = json.getAsJsonArray("reasonReference");
15717      for (int i = 0; i < array.size(); i++) {
15718        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15719      }
15720    }
15721    ;
15722    if (json.has("isSubpotent"))
15723      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
15724    if (json.has("_isSubpotent"))
15725      parseElementProperties(getJObject(json, "_isSubpotent"), res.getIsSubpotentElement());
15726    if (json.has("subpotentReason")) {
15727      JsonArray array = json.getAsJsonArray("subpotentReason");
15728      for (int i = 0; i < array.size(); i++) {
15729        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15730      }
15731    }
15732    ;
15733    if (json.has("education")) {
15734      JsonArray array = json.getAsJsonArray("education");
15735      for (int i = 0; i < array.size(); i++) {
15736        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
15737      }
15738    }
15739    ;
15740    if (json.has("programEligibility")) {
15741      JsonArray array = json.getAsJsonArray("programEligibility");
15742      for (int i = 0; i < array.size(); i++) {
15743        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15744      }
15745    }
15746    ;
15747    if (json.has("fundingSource"))
15748      res.setFundingSource(parseCodeableConcept(getJObject(json, "fundingSource")));
15749    if (json.has("reaction")) {
15750      JsonArray array = json.getAsJsonArray("reaction");
15751      for (int i = 0; i < array.size(); i++) {
15752        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
15753      }
15754    }
15755    ;
15756    if (json.has("protocolApplied")) {
15757      JsonArray array = json.getAsJsonArray("protocolApplied");
15758      for (int i = 0; i < array.size(); i++) {
15759        res.getProtocolApplied()
15760            .add(parseImmunizationImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject(), res));
15761      }
15762    }
15763    ;
15764  }
15765
15766  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json,
15767      Immunization owner) throws IOException, FHIRFormatError {
15768    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
15769    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
15770    return res;
15771  }
15772
15773  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner,
15774      Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
15775    parseBackboneElementProperties(json, res);
15776    if (json.has("function"))
15777      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
15778    if (json.has("actor"))
15779      res.setActor(parseReference(getJObject(json, "actor")));
15780  }
15781
15782  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json,
15783      Immunization owner) throws IOException, FHIRFormatError {
15784    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
15785    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
15786    return res;
15787  }
15788
15789  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner,
15790      Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
15791    parseBackboneElementProperties(json, res);
15792    if (json.has("documentType"))
15793      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
15794    if (json.has("_documentType"))
15795      parseElementProperties(getJObject(json, "_documentType"), res.getDocumentTypeElement());
15796    if (json.has("reference"))
15797      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
15798    if (json.has("_reference"))
15799      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
15800    if (json.has("publicationDate"))
15801      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
15802    if (json.has("_publicationDate"))
15803      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
15804    if (json.has("presentationDate"))
15805      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
15806    if (json.has("_presentationDate"))
15807      parseElementProperties(getJObject(json, "_presentationDate"), res.getPresentationDateElement());
15808  }
15809
15810  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json,
15811      Immunization owner) throws IOException, FHIRFormatError {
15812    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
15813    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
15814    return res;
15815  }
15816
15817  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner,
15818      Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
15819    parseBackboneElementProperties(json, res);
15820    if (json.has("date"))
15821      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15822    if (json.has("_date"))
15823      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15824    if (json.has("detail"))
15825      res.setDetail(parseReference(getJObject(json, "detail")));
15826    if (json.has("reported"))
15827      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
15828    if (json.has("_reported"))
15829      parseElementProperties(getJObject(json, "_reported"), res.getReportedElement());
15830  }
15831
15832  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationImmunizationProtocolAppliedComponent(
15833      JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
15834    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
15835    parseImmunizationImmunizationProtocolAppliedComponentProperties(json, owner, res);
15836    return res;
15837  }
15838
15839  protected void parseImmunizationImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization owner,
15840      Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
15841    parseBackboneElementProperties(json, res);
15842    if (json.has("series"))
15843      res.setSeriesElement(parseString(json.get("series").getAsString()));
15844    if (json.has("_series"))
15845      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
15846    if (json.has("authority"))
15847      res.setAuthority(parseReference(getJObject(json, "authority")));
15848    if (json.has("targetDisease")) {
15849      JsonArray array = json.getAsJsonArray("targetDisease");
15850      for (int i = 0; i < array.size(); i++) {
15851        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15852      }
15853    }
15854    ;
15855    Type doseNumber = parseType("doseNumber", json);
15856    if (doseNumber != null)
15857      res.setDoseNumber(doseNumber);
15858    Type seriesDoses = parseType("seriesDoses", json);
15859    if (seriesDoses != null)
15860      res.setSeriesDoses(seriesDoses);
15861  }
15862
15863  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
15864    ImmunizationEvaluation res = new ImmunizationEvaluation();
15865    parseImmunizationEvaluationProperties(json, res);
15866    return res;
15867  }
15868
15869  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res)
15870      throws IOException, FHIRFormatError {
15871    parseDomainResourceProperties(json, res);
15872    if (json.has("identifier")) {
15873      JsonArray array = json.getAsJsonArray("identifier");
15874      for (int i = 0; i < array.size(); i++) {
15875        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15876      }
15877    }
15878    ;
15879    if (json.has("status"))
15880      res.setStatusElement(
15881          parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL,
15882              new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
15883    if (json.has("_status"))
15884      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15885    if (json.has("patient"))
15886      res.setPatient(parseReference(getJObject(json, "patient")));
15887    if (json.has("date"))
15888      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15889    if (json.has("_date"))
15890      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15891    if (json.has("authority"))
15892      res.setAuthority(parseReference(getJObject(json, "authority")));
15893    if (json.has("targetDisease"))
15894      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
15895    if (json.has("immunizationEvent"))
15896      res.setImmunizationEvent(parseReference(getJObject(json, "immunizationEvent")));
15897    if (json.has("doseStatus"))
15898      res.setDoseStatus(parseCodeableConcept(getJObject(json, "doseStatus")));
15899    if (json.has("doseStatusReason")) {
15900      JsonArray array = json.getAsJsonArray("doseStatusReason");
15901      for (int i = 0; i < array.size(); i++) {
15902        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15903      }
15904    }
15905    ;
15906    if (json.has("description"))
15907      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15908    if (json.has("_description"))
15909      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15910    if (json.has("series"))
15911      res.setSeriesElement(parseString(json.get("series").getAsString()));
15912    if (json.has("_series"))
15913      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
15914    Type doseNumber = parseType("doseNumber", json);
15915    if (doseNumber != null)
15916      res.setDoseNumber(doseNumber);
15917    Type seriesDoses = parseType("seriesDoses", json);
15918    if (seriesDoses != null)
15919      res.setSeriesDoses(seriesDoses);
15920  }
15921
15922  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json)
15923      throws IOException, FHIRFormatError {
15924    ImmunizationRecommendation res = new ImmunizationRecommendation();
15925    parseImmunizationRecommendationProperties(json, res);
15926    return res;
15927  }
15928
15929  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res)
15930      throws IOException, FHIRFormatError {
15931    parseDomainResourceProperties(json, res);
15932    if (json.has("identifier")) {
15933      JsonArray array = json.getAsJsonArray("identifier");
15934      for (int i = 0; i < array.size(); i++) {
15935        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15936      }
15937    }
15938    ;
15939    if (json.has("patient"))
15940      res.setPatient(parseReference(getJObject(json, "patient")));
15941    if (json.has("date"))
15942      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15943    if (json.has("_date"))
15944      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15945    if (json.has("authority"))
15946      res.setAuthority(parseReference(getJObject(json, "authority")));
15947    if (json.has("recommendation")) {
15948      JsonArray array = json.getAsJsonArray("recommendation");
15949      for (int i = 0; i < array.size(); i++) {
15950        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(
15951            array.get(i).getAsJsonObject(), res));
15952      }
15953    }
15954    ;
15955  }
15956
15957  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(
15958      JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
15959    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
15960    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
15961    return res;
15962  }
15963
15964  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(
15965      JsonObject json, ImmunizationRecommendation owner,
15966      ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res)
15967      throws IOException, FHIRFormatError {
15968    parseBackboneElementProperties(json, res);
15969    if (json.has("vaccineCode")) {
15970      JsonArray array = json.getAsJsonArray("vaccineCode");
15971      for (int i = 0; i < array.size(); i++) {
15972        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15973      }
15974    }
15975    ;
15976    if (json.has("targetDisease"))
15977      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
15978    if (json.has("contraindicatedVaccineCode")) {
15979      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
15980      for (int i = 0; i < array.size(); i++) {
15981        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15982      }
15983    }
15984    ;
15985    if (json.has("forecastStatus"))
15986      res.setForecastStatus(parseCodeableConcept(getJObject(json, "forecastStatus")));
15987    if (json.has("forecastReason")) {
15988      JsonArray array = json.getAsJsonArray("forecastReason");
15989      for (int i = 0; i < array.size(); i++) {
15990        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15991      }
15992    }
15993    ;
15994    if (json.has("dateCriterion")) {
15995      JsonArray array = json.getAsJsonArray("dateCriterion");
15996      for (int i = 0; i < array.size(); i++) {
15997        res.getDateCriterion()
15998            .add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(
15999                array.get(i).getAsJsonObject(), owner));
16000      }
16001    }
16002    ;
16003    if (json.has("description"))
16004      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16005    if (json.has("_description"))
16006      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16007    if (json.has("series"))
16008      res.setSeriesElement(parseString(json.get("series").getAsString()));
16009    if (json.has("_series"))
16010      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
16011    Type doseNumber = parseType("doseNumber", json);
16012    if (doseNumber != null)
16013      res.setDoseNumber(doseNumber);
16014    Type seriesDoses = parseType("seriesDoses", json);
16015    if (seriesDoses != null)
16016      res.setSeriesDoses(seriesDoses);
16017    if (json.has("supportingImmunization")) {
16018      JsonArray array = json.getAsJsonArray("supportingImmunization");
16019      for (int i = 0; i < array.size(); i++) {
16020        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
16021      }
16022    }
16023    ;
16024    if (json.has("supportingPatientInformation")) {
16025      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
16026      for (int i = 0; i < array.size(); i++) {
16027        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
16028      }
16029    }
16030    ;
16031  }
16032
16033  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(
16034      JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
16035    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
16036    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner,
16037        res);
16038    return res;
16039  }
16040
16041  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(
16042      JsonObject json, ImmunizationRecommendation owner,
16043      ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res)
16044      throws IOException, FHIRFormatError {
16045    parseBackboneElementProperties(json, res);
16046    if (json.has("code"))
16047      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16048    if (json.has("value"))
16049      res.setValueElement(parseDateTime(json.get("value").getAsString()));
16050    if (json.has("_value"))
16051      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
16052  }
16053
16054  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
16055    ImplementationGuide res = new ImplementationGuide();
16056    parseImplementationGuideProperties(json, res);
16057    return res;
16058  }
16059
16060  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res)
16061      throws IOException, FHIRFormatError {
16062    parseDomainResourceProperties(json, res);
16063    if (json.has("url"))
16064      res.setUrlElement(parseUri(json.get("url").getAsString()));
16065    if (json.has("_url"))
16066      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
16067    if (json.has("version"))
16068      res.setVersionElement(parseString(json.get("version").getAsString()));
16069    if (json.has("_version"))
16070      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
16071    if (json.has("name"))
16072      res.setNameElement(parseString(json.get("name").getAsString()));
16073    if (json.has("_name"))
16074      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16075    if (json.has("title"))
16076      res.setTitleElement(parseString(json.get("title").getAsString()));
16077    if (json.has("_title"))
16078      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
16079    if (json.has("status"))
16080      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
16081          new Enumerations.PublicationStatusEnumFactory()));
16082    if (json.has("_status"))
16083      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16084    if (json.has("experimental"))
16085      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16086    if (json.has("_experimental"))
16087      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
16088    if (json.has("date"))
16089      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16090    if (json.has("_date"))
16091      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16092    if (json.has("publisher"))
16093      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16094    if (json.has("_publisher"))
16095      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
16096    if (json.has("contact")) {
16097      JsonArray array = json.getAsJsonArray("contact");
16098      for (int i = 0; i < array.size(); i++) {
16099        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16100      }
16101    }
16102    ;
16103    if (json.has("description"))
16104      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16105    if (json.has("_description"))
16106      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16107    if (json.has("useContext")) {
16108      JsonArray array = json.getAsJsonArray("useContext");
16109      for (int i = 0; i < array.size(); i++) {
16110        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16111      }
16112    }
16113    ;
16114    if (json.has("jurisdiction")) {
16115      JsonArray array = json.getAsJsonArray("jurisdiction");
16116      for (int i = 0; i < array.size(); i++) {
16117        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16118      }
16119    }
16120    ;
16121    if (json.has("copyright"))
16122      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
16123    if (json.has("_copyright"))
16124      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
16125    if (json.has("packageId"))
16126      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
16127    if (json.has("_packageId"))
16128      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
16129    if (json.has("license"))
16130      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL,
16131          new ImplementationGuide.SPDXLicenseEnumFactory()));
16132    if (json.has("_license"))
16133      parseElementProperties(getJObject(json, "_license"), res.getLicenseElement());
16134    if (json.has("fhirVersion")) {
16135      JsonArray array = json.getAsJsonArray("fhirVersion");
16136      for (int i = 0; i < array.size(); i++) {
16137        if (array.get(i).isJsonNull()) {
16138          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>());
16139        } else {
16140          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL,
16141              new Enumerations.FHIRVersionEnumFactory()));
16142        }
16143      }
16144    }
16145    ;
16146    if (json.has("_fhirVersion")) {
16147      JsonArray array = json.getAsJsonArray("_fhirVersion");
16148      for (int i = 0; i < array.size(); i++) {
16149        if (i == res.getFhirVersion().size())
16150          res.getFhirVersion()
16151              .add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
16152        if (array.get(i) instanceof JsonObject)
16153          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
16154      }
16155    }
16156    ;
16157    if (json.has("dependsOn")) {
16158      JsonArray array = json.getAsJsonArray("dependsOn");
16159      for (int i = 0; i < array.size(); i++) {
16160        res.getDependsOn()
16161            .add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
16162      }
16163    }
16164    ;
16165    if (json.has("global")) {
16166      JsonArray array = json.getAsJsonArray("global");
16167      for (int i = 0; i < array.size(); i++) {
16168        res.getGlobal()
16169            .add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
16170      }
16171    }
16172    ;
16173    if (json.has("definition"))
16174      res.setDefinition(
16175          parseImplementationGuideImplementationGuideDefinitionComponent(getJObject(json, "definition"), res));
16176    if (json.has("manifest"))
16177      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(getJObject(json, "manifest"), res));
16178  }
16179
16180  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(
16181      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16182    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
16183    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
16184    return res;
16185  }
16186
16187  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json,
16188      ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res)
16189      throws IOException, FHIRFormatError {
16190    parseBackboneElementProperties(json, res);
16191    if (json.has("uri"))
16192      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
16193    if (json.has("_uri"))
16194      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
16195    if (json.has("packageId"))
16196      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
16197    if (json.has("_packageId"))
16198      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
16199    if (json.has("version"))
16200      res.setVersionElement(parseString(json.get("version").getAsString()));
16201    if (json.has("_version"))
16202      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
16203  }
16204
16205  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(
16206      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16207    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
16208    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
16209    return res;
16210  }
16211
16212  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json,
16213      ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res)
16214      throws IOException, FHIRFormatError {
16215    parseBackboneElementProperties(json, res);
16216    if (json.has("type"))
16217      res.setTypeElement(parseCode(json.get("type").getAsString()));
16218    if (json.has("_type"))
16219      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
16220    if (json.has("profile"))
16221      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
16222    if (json.has("_profile"))
16223      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
16224  }
16225
16226  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(
16227      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16228    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
16229    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
16230    return res;
16231  }
16232
16233  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json,
16234      ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res)
16235      throws IOException, FHIRFormatError {
16236    parseBackboneElementProperties(json, res);
16237    if (json.has("grouping")) {
16238      JsonArray array = json.getAsJsonArray("grouping");
16239      for (int i = 0; i < array.size(); i++) {
16240        res.getGrouping().add(parseImplementationGuideImplementationGuideDefinitionGroupingComponent(
16241            array.get(i).getAsJsonObject(), owner));
16242      }
16243    }
16244    ;
16245    if (json.has("resource")) {
16246      JsonArray array = json.getAsJsonArray("resource");
16247      for (int i = 0; i < array.size(); i++) {
16248        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(
16249            array.get(i).getAsJsonObject(), owner));
16250      }
16251    }
16252    ;
16253    if (json.has("page"))
16254      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(getJObject(json, "page"), owner));
16255    if (json.has("parameter")) {
16256      JsonArray array = json.getAsJsonArray("parameter");
16257      for (int i = 0; i < array.size(); i++) {
16258        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(
16259            array.get(i).getAsJsonObject(), owner));
16260      }
16261    }
16262    ;
16263    if (json.has("template")) {
16264      JsonArray array = json.getAsJsonArray("template");
16265      for (int i = 0; i < array.size(); i++) {
16266        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(
16267            array.get(i).getAsJsonObject(), owner));
16268      }
16269    }
16270    ;
16271  }
16272
16273  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideImplementationGuideDefinitionGroupingComponent(
16274      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16275    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
16276    parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(json, owner, res);
16277    return res;
16278  }
16279
16280  protected void parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(JsonObject json,
16281      ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res)
16282      throws IOException, FHIRFormatError {
16283    parseBackboneElementProperties(json, res);
16284    if (json.has("name"))
16285      res.setNameElement(parseString(json.get("name").getAsString()));
16286    if (json.has("_name"))
16287      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16288    if (json.has("description"))
16289      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16290    if (json.has("_description"))
16291      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16292  }
16293
16294  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(
16295      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16296    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
16297    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
16298    return res;
16299  }
16300
16301  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json,
16302      ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res)
16303      throws IOException, FHIRFormatError {
16304    parseBackboneElementProperties(json, res);
16305    if (json.has("reference"))
16306      res.setReference(parseReference(getJObject(json, "reference")));
16307    if (json.has("fhirVersion")) {
16308      JsonArray array = json.getAsJsonArray("fhirVersion");
16309      for (int i = 0; i < array.size(); i++) {
16310        if (array.get(i).isJsonNull()) {
16311          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>());
16312        } else {
16313          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL,
16314              new Enumerations.FHIRVersionEnumFactory()));
16315        }
16316      }
16317    }
16318    ;
16319    if (json.has("_fhirVersion")) {
16320      JsonArray array = json.getAsJsonArray("_fhirVersion");
16321      for (int i = 0; i < array.size(); i++) {
16322        if (i == res.getFhirVersion().size())
16323          res.getFhirVersion()
16324              .add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
16325        if (array.get(i) instanceof JsonObject)
16326          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
16327      }
16328    }
16329    ;
16330    if (json.has("name"))
16331      res.setNameElement(parseString(json.get("name").getAsString()));
16332    if (json.has("_name"))
16333      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16334    if (json.has("description"))
16335      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16336    if (json.has("_description"))
16337      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16338    Type example = parseType("example", json);
16339    if (example != null)
16340      res.setExample(example);
16341    if (json.has("groupingId"))
16342      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
16343    if (json.has("_groupingId"))
16344      parseElementProperties(getJObject(json, "_groupingId"), res.getGroupingIdElement());
16345  }
16346
16347  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(
16348      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16349    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
16350    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
16351    return res;
16352  }
16353
16354  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json,
16355      ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res)
16356      throws IOException, FHIRFormatError {
16357    parseBackboneElementProperties(json, res);
16358    Type name = parseType("name", json);
16359    if (name != null)
16360      res.setName(name);
16361    if (json.has("title"))
16362      res.setTitleElement(parseString(json.get("title").getAsString()));
16363    if (json.has("_title"))
16364      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
16365    if (json.has("generation"))
16366      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(),
16367          ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
16368    if (json.has("_generation"))
16369      parseElementProperties(getJObject(json, "_generation"), res.getGenerationElement());
16370    if (json.has("page")) {
16371      JsonArray array = json.getAsJsonArray("page");
16372      for (int i = 0; i < array.size(); i++) {
16373        res.getPage().add(
16374            parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
16375      }
16376    }
16377    ;
16378  }
16379
16380  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(
16381      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16382    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
16383    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
16384    return res;
16385  }
16386
16387  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json,
16388      ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res)
16389      throws IOException, FHIRFormatError {
16390    parseBackboneElementProperties(json, res);
16391    if (json.has("code"))
16392      res.setCodeElement(parseString(json.get("code").getAsString()));
16393    if (json.has("_code"))
16394      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
16395    if (json.has("value"))
16396      res.setValueElement(parseString(json.get("value").getAsString()));
16397    if (json.has("_value"))
16398      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
16399  }
16400
16401  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(
16402      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16403    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
16404    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
16405    return res;
16406  }
16407
16408  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json,
16409      ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res)
16410      throws IOException, FHIRFormatError {
16411    parseBackboneElementProperties(json, res);
16412    if (json.has("code"))
16413      res.setCodeElement(parseCode(json.get("code").getAsString()));
16414    if (json.has("_code"))
16415      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
16416    if (json.has("source"))
16417      res.setSourceElement(parseString(json.get("source").getAsString()));
16418    if (json.has("_source"))
16419      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
16420    if (json.has("scope"))
16421      res.setScopeElement(parseString(json.get("scope").getAsString()));
16422    if (json.has("_scope"))
16423      parseElementProperties(getJObject(json, "_scope"), res.getScopeElement());
16424  }
16425
16426  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(
16427      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16428    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
16429    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
16430    return res;
16431  }
16432
16433  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json,
16434      ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res)
16435      throws IOException, FHIRFormatError {
16436    parseBackboneElementProperties(json, res);
16437    if (json.has("rendering"))
16438      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
16439    if (json.has("_rendering"))
16440      parseElementProperties(getJObject(json, "_rendering"), res.getRenderingElement());
16441    if (json.has("resource")) {
16442      JsonArray array = json.getAsJsonArray("resource");
16443      for (int i = 0; i < array.size(); i++) {
16444        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
16445      }
16446    }
16447    ;
16448    if (json.has("page")) {
16449      JsonArray array = json.getAsJsonArray("page");
16450      for (int i = 0; i < array.size(); i++) {
16451        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
16452      }
16453    }
16454    ;
16455    if (json.has("image")) {
16456      JsonArray array = json.getAsJsonArray("image");
16457      for (int i = 0; i < array.size(); i++) {
16458        if (array.get(i).isJsonNull()) {
16459          res.getImage().add(new StringType());
16460        } else {
16461          res.getImage().add(parseString(array.get(i).getAsString()));
16462        }
16463      }
16464    }
16465    ;
16466    if (json.has("_image")) {
16467      JsonArray array = json.getAsJsonArray("_image");
16468      for (int i = 0; i < array.size(); i++) {
16469        if (i == res.getImage().size())
16470          res.getImage().add(parseString(null));
16471        if (array.get(i) instanceof JsonObject)
16472          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
16473      }
16474    }
16475    ;
16476    if (json.has("other")) {
16477      JsonArray array = json.getAsJsonArray("other");
16478      for (int i = 0; i < array.size(); i++) {
16479        if (array.get(i).isJsonNull()) {
16480          res.getOther().add(new StringType());
16481        } else {
16482          res.getOther().add(parseString(array.get(i).getAsString()));
16483        }
16484      }
16485    }
16486    ;
16487    if (json.has("_other")) {
16488      JsonArray array = json.getAsJsonArray("_other");
16489      for (int i = 0; i < array.size(); i++) {
16490        if (i == res.getOther().size())
16491          res.getOther().add(parseString(null));
16492        if (array.get(i) instanceof JsonObject)
16493          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
16494      }
16495    }
16496    ;
16497  }
16498
16499  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(
16500      JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
16501    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
16502    parseImplementationGuideManifestResourceComponentProperties(json, owner, res);
16503    return res;
16504  }
16505
16506  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner,
16507      ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
16508    parseBackboneElementProperties(json, res);
16509    if (json.has("reference"))
16510      res.setReference(parseReference(getJObject(json, "reference")));
16511    Type example = parseType("example", json);
16512    if (example != null)
16513      res.setExample(example);
16514    if (json.has("relativePath"))
16515      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
16516    if (json.has("_relativePath"))
16517      parseElementProperties(getJObject(json, "_relativePath"), res.getRelativePathElement());
16518  }
16519
16520  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json,
16521      ImplementationGuide owner) throws IOException, FHIRFormatError {
16522    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
16523    parseImplementationGuideManifestPageComponentProperties(json, owner, res);
16524    return res;
16525  }
16526
16527  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner,
16528      ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
16529    parseBackboneElementProperties(json, res);
16530    if (json.has("name"))
16531      res.setNameElement(parseString(json.get("name").getAsString()));
16532    if (json.has("_name"))
16533      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16534    if (json.has("title"))
16535      res.setTitleElement(parseString(json.get("title").getAsString()));
16536    if (json.has("_title"))
16537      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
16538    if (json.has("anchor")) {
16539      JsonArray array = json.getAsJsonArray("anchor");
16540      for (int i = 0; i < array.size(); i++) {
16541        if (array.get(i).isJsonNull()) {
16542          res.getAnchor().add(new StringType());
16543        } else {
16544          res.getAnchor().add(parseString(array.get(i).getAsString()));
16545        }
16546      }
16547    }
16548    ;
16549    if (json.has("_anchor")) {
16550      JsonArray array = json.getAsJsonArray("_anchor");
16551      for (int i = 0; i < array.size(); i++) {
16552        if (i == res.getAnchor().size())
16553          res.getAnchor().add(parseString(null));
16554        if (array.get(i) instanceof JsonObject)
16555          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
16556      }
16557    }
16558    ;
16559  }
16560
16561  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
16562    InsurancePlan res = new InsurancePlan();
16563    parseInsurancePlanProperties(json, res);
16564    return res;
16565  }
16566
16567  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
16568    parseDomainResourceProperties(json, res);
16569    if (json.has("identifier")) {
16570      JsonArray array = json.getAsJsonArray("identifier");
16571      for (int i = 0; i < array.size(); i++) {
16572        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16573      }
16574    }
16575    ;
16576    if (json.has("status"))
16577      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
16578          new Enumerations.PublicationStatusEnumFactory()));
16579    if (json.has("_status"))
16580      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16581    if (json.has("type")) {
16582      JsonArray array = json.getAsJsonArray("type");
16583      for (int i = 0; i < array.size(); i++) {
16584        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16585      }
16586    }
16587    ;
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("alias")) {
16593      JsonArray array = json.getAsJsonArray("alias");
16594      for (int i = 0; i < array.size(); i++) {
16595        if (array.get(i).isJsonNull()) {
16596          res.getAlias().add(new StringType());
16597        } else {
16598          res.getAlias().add(parseString(array.get(i).getAsString()));
16599        }
16600      }
16601    }
16602    ;
16603    if (json.has("_alias")) {
16604      JsonArray array = json.getAsJsonArray("_alias");
16605      for (int i = 0; i < array.size(); i++) {
16606        if (i == res.getAlias().size())
16607          res.getAlias().add(parseString(null));
16608        if (array.get(i) instanceof JsonObject)
16609          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
16610      }
16611    }
16612    ;
16613    if (json.has("period"))
16614      res.setPeriod(parsePeriod(getJObject(json, "period")));
16615    if (json.has("ownedBy"))
16616      res.setOwnedBy(parseReference(getJObject(json, "ownedBy")));
16617    if (json.has("administeredBy"))
16618      res.setAdministeredBy(parseReference(getJObject(json, "administeredBy")));
16619    if (json.has("coverageArea")) {
16620      JsonArray array = json.getAsJsonArray("coverageArea");
16621      for (int i = 0; i < array.size(); i++) {
16622        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
16623      }
16624    }
16625    ;
16626    if (json.has("contact")) {
16627      JsonArray array = json.getAsJsonArray("contact");
16628      for (int i = 0; i < array.size(); i++) {
16629        res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(array.get(i).getAsJsonObject(), res));
16630      }
16631    }
16632    ;
16633    if (json.has("endpoint")) {
16634      JsonArray array = json.getAsJsonArray("endpoint");
16635      for (int i = 0; i < array.size(); i++) {
16636        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
16637      }
16638    }
16639    ;
16640    if (json.has("network")) {
16641      JsonArray array = json.getAsJsonArray("network");
16642      for (int i = 0; i < array.size(); i++) {
16643        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16644      }
16645    }
16646    ;
16647    if (json.has("coverage")) {
16648      JsonArray array = json.getAsJsonArray("coverage");
16649      for (int i = 0; i < array.size(); i++) {
16650        res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(array.get(i).getAsJsonObject(), res));
16651      }
16652    }
16653    ;
16654    if (json.has("plan")) {
16655      JsonArray array = json.getAsJsonArray("plan");
16656      for (int i = 0; i < array.size(); i++) {
16657        res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(array.get(i).getAsJsonObject(), res));
16658      }
16659    }
16660    ;
16661  }
16662
16663  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(JsonObject json,
16664      InsurancePlan owner) throws IOException, FHIRFormatError {
16665    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
16666    parseInsurancePlanInsurancePlanContactComponentProperties(json, owner, res);
16667    return res;
16668  }
16669
16670  protected void parseInsurancePlanInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan owner,
16671      InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
16672    parseBackboneElementProperties(json, res);
16673    if (json.has("purpose"))
16674      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
16675    if (json.has("name"))
16676      res.setName(parseHumanName(getJObject(json, "name")));
16677    if (json.has("telecom")) {
16678      JsonArray array = json.getAsJsonArray("telecom");
16679      for (int i = 0; i < array.size(); i++) {
16680        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16681      }
16682    }
16683    ;
16684    if (json.has("address"))
16685      res.setAddress(parseAddress(getJObject(json, "address")));
16686  }
16687
16688  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(
16689      JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
16690    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
16691    parseInsurancePlanInsurancePlanCoverageComponentProperties(json, owner, res);
16692    return res;
16693  }
16694
16695  protected void parseInsurancePlanInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan owner,
16696      InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
16697    parseBackboneElementProperties(json, res);
16698    if (json.has("type"))
16699      res.setType(parseCodeableConcept(getJObject(json, "type")));
16700    if (json.has("network")) {
16701      JsonArray array = json.getAsJsonArray("network");
16702      for (int i = 0; i < array.size(); i++) {
16703        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16704      }
16705    }
16706    ;
16707    if (json.has("benefit")) {
16708      JsonArray array = json.getAsJsonArray("benefit");
16709      for (int i = 0; i < array.size(); i++) {
16710        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
16711      }
16712    }
16713    ;
16714  }
16715
16716  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json,
16717      InsurancePlan owner) throws IOException, FHIRFormatError {
16718    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
16719    parseInsurancePlanCoverageBenefitComponentProperties(json, owner, res);
16720    return res;
16721  }
16722
16723  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan owner,
16724      InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
16725    parseBackboneElementProperties(json, res);
16726    if (json.has("type"))
16727      res.setType(parseCodeableConcept(getJObject(json, "type")));
16728    if (json.has("requirement"))
16729      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
16730    if (json.has("_requirement"))
16731      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
16732    if (json.has("limit")) {
16733      JsonArray array = json.getAsJsonArray("limit");
16734      for (int i = 0; i < array.size(); i++) {
16735        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
16736      }
16737    }
16738    ;
16739  }
16740
16741  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json,
16742      InsurancePlan owner) throws IOException, FHIRFormatError {
16743    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
16744    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, owner, res);
16745    return res;
16746  }
16747
16748  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan owner,
16749      InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
16750    parseBackboneElementProperties(json, res);
16751    if (json.has("value"))
16752      res.setValue(parseQuantity(getJObject(json, "value")));
16753    if (json.has("code"))
16754      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16755  }
16756
16757  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(JsonObject json,
16758      InsurancePlan owner) throws IOException, FHIRFormatError {
16759    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
16760    parseInsurancePlanInsurancePlanPlanComponentProperties(json, owner, res);
16761    return res;
16762  }
16763
16764  protected void parseInsurancePlanInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan owner,
16765      InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
16766    parseBackboneElementProperties(json, res);
16767    if (json.has("identifier")) {
16768      JsonArray array = json.getAsJsonArray("identifier");
16769      for (int i = 0; i < array.size(); i++) {
16770        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16771      }
16772    }
16773    ;
16774    if (json.has("type"))
16775      res.setType(parseCodeableConcept(getJObject(json, "type")));
16776    if (json.has("coverageArea")) {
16777      JsonArray array = json.getAsJsonArray("coverageArea");
16778      for (int i = 0; i < array.size(); i++) {
16779        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
16780      }
16781    }
16782    ;
16783    if (json.has("network")) {
16784      JsonArray array = json.getAsJsonArray("network");
16785      for (int i = 0; i < array.size(); i++) {
16786        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16787      }
16788    }
16789    ;
16790    if (json.has("generalCost")) {
16791      JsonArray array = json.getAsJsonArray("generalCost");
16792      for (int i = 0; i < array.size(); i++) {
16793        res.getGeneralCost()
16794            .add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
16795      }
16796    }
16797    ;
16798    if (json.has("specificCost")) {
16799      JsonArray array = json.getAsJsonArray("specificCost");
16800      for (int i = 0; i < array.size(); i++) {
16801        res.getSpecificCost()
16802            .add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
16803      }
16804    }
16805    ;
16806  }
16807
16808  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(
16809      JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
16810    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
16811    parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(json, owner, res);
16812    return res;
16813  }
16814
16815  protected void parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan owner,
16816      InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
16817    parseBackboneElementProperties(json, res);
16818    if (json.has("type"))
16819      res.setType(parseCodeableConcept(getJObject(json, "type")));
16820    if (json.has("groupSize"))
16821      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
16822    if (json.has("_groupSize"))
16823      parseElementProperties(getJObject(json, "_groupSize"), res.getGroupSizeElement());
16824    if (json.has("cost"))
16825      res.setCost(parseMoney(getJObject(json, "cost")));
16826    if (json.has("comment"))
16827      res.setCommentElement(parseString(json.get("comment").getAsString()));
16828    if (json.has("_comment"))
16829      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
16830  }
16831
16832  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(
16833      JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
16834    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
16835    parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(json, owner, res);
16836    return res;
16837  }
16838
16839  protected void parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(JsonObject json,
16840      InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent res)
16841      throws IOException, FHIRFormatError {
16842    parseBackboneElementProperties(json, res);
16843    if (json.has("category"))
16844      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16845    if (json.has("benefit")) {
16846      JsonArray array = json.getAsJsonArray("benefit");
16847      for (int i = 0; i < array.size(); i++) {
16848        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject(), owner));
16849      }
16850    }
16851    ;
16852  }
16853
16854  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json,
16855      InsurancePlan owner) throws IOException, FHIRFormatError {
16856    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
16857    parseInsurancePlanPlanBenefitComponentProperties(json, owner, res);
16858    return res;
16859  }
16860
16861  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan owner,
16862      InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
16863    parseBackboneElementProperties(json, res);
16864    if (json.has("type"))
16865      res.setType(parseCodeableConcept(getJObject(json, "type")));
16866    if (json.has("cost")) {
16867      JsonArray array = json.getAsJsonArray("cost");
16868      for (int i = 0; i < array.size(); i++) {
16869        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
16870      }
16871    }
16872    ;
16873  }
16874
16875  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json,
16876      InsurancePlan owner) throws IOException, FHIRFormatError {
16877    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
16878    parseInsurancePlanPlanBenefitCostComponentProperties(json, owner, res);
16879    return res;
16880  }
16881
16882  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan owner,
16883      InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
16884    parseBackboneElementProperties(json, res);
16885    if (json.has("type"))
16886      res.setType(parseCodeableConcept(getJObject(json, "type")));
16887    if (json.has("applicability"))
16888      res.setApplicability(parseCodeableConcept(getJObject(json, "applicability")));
16889    if (json.has("qualifiers")) {
16890      JsonArray array = json.getAsJsonArray("qualifiers");
16891      for (int i = 0; i < array.size(); i++) {
16892        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16893      }
16894    }
16895    ;
16896    if (json.has("value"))
16897      res.setValue(parseQuantity(getJObject(json, "value")));
16898  }
16899
16900  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
16901    Invoice res = new Invoice();
16902    parseInvoiceProperties(json, res);
16903    return res;
16904  }
16905
16906  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
16907    parseDomainResourceProperties(json, res);
16908    if (json.has("identifier")) {
16909      JsonArray array = json.getAsJsonArray("identifier");
16910      for (int i = 0; i < array.size(); i++) {
16911        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16912      }
16913    }
16914    ;
16915    if (json.has("status"))
16916      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL,
16917          new Invoice.InvoiceStatusEnumFactory()));
16918    if (json.has("_status"))
16919      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16920    if (json.has("cancelledReason"))
16921      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
16922    if (json.has("_cancelledReason"))
16923      parseElementProperties(getJObject(json, "_cancelledReason"), res.getCancelledReasonElement());
16924    if (json.has("type"))
16925      res.setType(parseCodeableConcept(getJObject(json, "type")));
16926    if (json.has("subject"))
16927      res.setSubject(parseReference(getJObject(json, "subject")));
16928    if (json.has("recipient"))
16929      res.setRecipient(parseReference(getJObject(json, "recipient")));
16930    if (json.has("date"))
16931      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16932    if (json.has("_date"))
16933      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16934    if (json.has("participant")) {
16935      JsonArray array = json.getAsJsonArray("participant");
16936      for (int i = 0; i < array.size(); i++) {
16937        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
16938      }
16939    }
16940    ;
16941    if (json.has("issuer"))
16942      res.setIssuer(parseReference(getJObject(json, "issuer")));
16943    if (json.has("account"))
16944      res.setAccount(parseReference(getJObject(json, "account")));
16945    if (json.has("lineItem")) {
16946      JsonArray array = json.getAsJsonArray("lineItem");
16947      for (int i = 0; i < array.size(); i++) {
16948        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
16949      }
16950    }
16951    ;
16952    if (json.has("totalPriceComponent")) {
16953      JsonArray array = json.getAsJsonArray("totalPriceComponent");
16954      for (int i = 0; i < array.size(); i++) {
16955        res.getTotalPriceComponent()
16956            .add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
16957      }
16958    }
16959    ;
16960    if (json.has("totalNet"))
16961      res.setTotalNet(parseMoney(getJObject(json, "totalNet")));
16962    if (json.has("totalGross"))
16963      res.setTotalGross(parseMoney(getJObject(json, "totalGross")));
16964    if (json.has("paymentTerms"))
16965      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
16966    if (json.has("_paymentTerms"))
16967      parseElementProperties(getJObject(json, "_paymentTerms"), res.getPaymentTermsElement());
16968    if (json.has("note")) {
16969      JsonArray array = json.getAsJsonArray("note");
16970      for (int i = 0; i < array.size(); i++) {
16971        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16972      }
16973    }
16974    ;
16975  }
16976
16977  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner)
16978      throws IOException, FHIRFormatError {
16979    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
16980    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
16981    return res;
16982  }
16983
16984  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner,
16985      Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
16986    parseBackboneElementProperties(json, res);
16987    if (json.has("role"))
16988      res.setRole(parseCodeableConcept(getJObject(json, "role")));
16989    if (json.has("actor"))
16990      res.setActor(parseReference(getJObject(json, "actor")));
16991  }
16992
16993  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner)
16994      throws IOException, FHIRFormatError {
16995    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
16996    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
16997    return res;
16998  }
16999
17000  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner,
17001      Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
17002    parseBackboneElementProperties(json, res);
17003    if (json.has("sequence"))
17004      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
17005    if (json.has("_sequence"))
17006      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
17007    Type chargeItem = parseType("chargeItem", json);
17008    if (chargeItem != null)
17009      res.setChargeItem(chargeItem);
17010    if (json.has("priceComponent")) {
17011      JsonArray array = json.getAsJsonArray("priceComponent");
17012      for (int i = 0; i < array.size(); i++) {
17013        res.getPriceComponent()
17014            .add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
17015      }
17016    }
17017    ;
17018  }
17019
17020  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(
17021      JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
17022    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
17023    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
17024    return res;
17025  }
17026
17027  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner,
17028      Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
17029    parseBackboneElementProperties(json, res);
17030    if (json.has("type"))
17031      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL,
17032          new Invoice.InvoicePriceComponentTypeEnumFactory()));
17033    if (json.has("_type"))
17034      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17035    if (json.has("code"))
17036      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17037    if (json.has("factor"))
17038      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
17039    if (json.has("_factor"))
17040      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
17041    if (json.has("amount"))
17042      res.setAmount(parseMoney(getJObject(json, "amount")));
17043  }
17044
17045  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
17046    Library res = new Library();
17047    parseLibraryProperties(json, res);
17048    return res;
17049  }
17050
17051  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
17052    parseDomainResourceProperties(json, res);
17053    if (json.has("url"))
17054      res.setUrlElement(parseUri(json.get("url").getAsString()));
17055    if (json.has("_url"))
17056      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17057    if (json.has("identifier")) {
17058      JsonArray array = json.getAsJsonArray("identifier");
17059      for (int i = 0; i < array.size(); i++) {
17060        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17061      }
17062    }
17063    ;
17064    if (json.has("version"))
17065      res.setVersionElement(parseString(json.get("version").getAsString()));
17066    if (json.has("_version"))
17067      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17068    if (json.has("name"))
17069      res.setNameElement(parseString(json.get("name").getAsString()));
17070    if (json.has("_name"))
17071      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17072    if (json.has("title"))
17073      res.setTitleElement(parseString(json.get("title").getAsString()));
17074    if (json.has("_title"))
17075      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17076    if (json.has("subtitle"))
17077      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
17078    if (json.has("_subtitle"))
17079      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
17080    if (json.has("status"))
17081      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
17082          new Enumerations.PublicationStatusEnumFactory()));
17083    if (json.has("_status"))
17084      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17085    if (json.has("experimental"))
17086      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17087    if (json.has("_experimental"))
17088      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17089    if (json.has("type"))
17090      res.setType(parseCodeableConcept(getJObject(json, "type")));
17091    Type subject = parseType("subject", json);
17092    if (subject != null)
17093      res.setSubject(subject);
17094    if (json.has("date"))
17095      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17096    if (json.has("_date"))
17097      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17098    if (json.has("publisher"))
17099      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17100    if (json.has("_publisher"))
17101      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17102    if (json.has("contact")) {
17103      JsonArray array = json.getAsJsonArray("contact");
17104      for (int i = 0; i < array.size(); i++) {
17105        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17106      }
17107    }
17108    ;
17109    if (json.has("description"))
17110      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17111    if (json.has("_description"))
17112      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17113    if (json.has("useContext")) {
17114      JsonArray array = json.getAsJsonArray("useContext");
17115      for (int i = 0; i < array.size(); i++) {
17116        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17117      }
17118    }
17119    ;
17120    if (json.has("jurisdiction")) {
17121      JsonArray array = json.getAsJsonArray("jurisdiction");
17122      for (int i = 0; i < array.size(); i++) {
17123        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17124      }
17125    }
17126    ;
17127    if (json.has("purpose"))
17128      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17129    if (json.has("_purpose"))
17130      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17131    if (json.has("usage"))
17132      res.setUsageElement(parseString(json.get("usage").getAsString()));
17133    if (json.has("_usage"))
17134      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
17135    if (json.has("copyright"))
17136      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17137    if (json.has("_copyright"))
17138      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17139    if (json.has("approvalDate"))
17140      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
17141    if (json.has("_approvalDate"))
17142      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
17143    if (json.has("lastReviewDate"))
17144      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
17145    if (json.has("_lastReviewDate"))
17146      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
17147    if (json.has("effectivePeriod"))
17148      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
17149    if (json.has("topic")) {
17150      JsonArray array = json.getAsJsonArray("topic");
17151      for (int i = 0; i < array.size(); i++) {
17152        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17153      }
17154    }
17155    ;
17156    if (json.has("author")) {
17157      JsonArray array = json.getAsJsonArray("author");
17158      for (int i = 0; i < array.size(); i++) {
17159        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
17160      }
17161    }
17162    ;
17163    if (json.has("editor")) {
17164      JsonArray array = json.getAsJsonArray("editor");
17165      for (int i = 0; i < array.size(); i++) {
17166        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
17167      }
17168    }
17169    ;
17170    if (json.has("reviewer")) {
17171      JsonArray array = json.getAsJsonArray("reviewer");
17172      for (int i = 0; i < array.size(); i++) {
17173        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
17174      }
17175    }
17176    ;
17177    if (json.has("endorser")) {
17178      JsonArray array = json.getAsJsonArray("endorser");
17179      for (int i = 0; i < array.size(); i++) {
17180        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
17181      }
17182    }
17183    ;
17184    if (json.has("relatedArtifact")) {
17185      JsonArray array = json.getAsJsonArray("relatedArtifact");
17186      for (int i = 0; i < array.size(); i++) {
17187        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
17188      }
17189    }
17190    ;
17191    if (json.has("parameter")) {
17192      JsonArray array = json.getAsJsonArray("parameter");
17193      for (int i = 0; i < array.size(); i++) {
17194        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
17195      }
17196    }
17197    ;
17198    if (json.has("dataRequirement")) {
17199      JsonArray array = json.getAsJsonArray("dataRequirement");
17200      for (int i = 0; i < array.size(); i++) {
17201        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
17202      }
17203    }
17204    ;
17205    if (json.has("content")) {
17206      JsonArray array = json.getAsJsonArray("content");
17207      for (int i = 0; i < array.size(); i++) {
17208        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
17209      }
17210    }
17211    ;
17212  }
17213
17214  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
17215    Linkage res = new Linkage();
17216    parseLinkageProperties(json, res);
17217    return res;
17218  }
17219
17220  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
17221    parseDomainResourceProperties(json, res);
17222    if (json.has("active"))
17223      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
17224    if (json.has("_active"))
17225      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
17226    if (json.has("author"))
17227      res.setAuthor(parseReference(getJObject(json, "author")));
17228    if (json.has("item")) {
17229      JsonArray array = json.getAsJsonArray("item");
17230      for (int i = 0; i < array.size(); i++) {
17231        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
17232      }
17233    }
17234    ;
17235  }
17236
17237  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner)
17238      throws IOException, FHIRFormatError {
17239    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
17240    parseLinkageLinkageItemComponentProperties(json, owner, res);
17241    return res;
17242  }
17243
17244  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner,
17245      Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
17246    parseBackboneElementProperties(json, res);
17247    if (json.has("type"))
17248      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL,
17249          new Linkage.LinkageTypeEnumFactory()));
17250    if (json.has("_type"))
17251      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17252    if (json.has("resource"))
17253      res.setResource(parseReference(getJObject(json, "resource")));
17254  }
17255
17256  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
17257    ListResource res = new ListResource();
17258    parseListResourceProperties(json, res);
17259    return res;
17260  }
17261
17262  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
17263    parseDomainResourceProperties(json, res);
17264    if (json.has("identifier")) {
17265      JsonArray array = json.getAsJsonArray("identifier");
17266      for (int i = 0; i < array.size(); i++) {
17267        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17268      }
17269    }
17270    ;
17271    if (json.has("status"))
17272      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL,
17273          new ListResource.ListStatusEnumFactory()));
17274    if (json.has("_status"))
17275      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17276    if (json.has("mode"))
17277      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL,
17278          new ListResource.ListModeEnumFactory()));
17279    if (json.has("_mode"))
17280      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
17281    if (json.has("title"))
17282      res.setTitleElement(parseString(json.get("title").getAsString()));
17283    if (json.has("_title"))
17284      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17285    if (json.has("code"))
17286      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17287    if (json.has("subject"))
17288      res.setSubject(parseReference(getJObject(json, "subject")));
17289    if (json.has("encounter"))
17290      res.setEncounter(parseReference(getJObject(json, "encounter")));
17291    if (json.has("date"))
17292      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17293    if (json.has("_date"))
17294      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17295    if (json.has("source"))
17296      res.setSource(parseReference(getJObject(json, "source")));
17297    if (json.has("orderedBy"))
17298      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
17299    if (json.has("note")) {
17300      JsonArray array = json.getAsJsonArray("note");
17301      for (int i = 0; i < array.size(); i++) {
17302        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17303      }
17304    }
17305    ;
17306    if (json.has("entry")) {
17307      JsonArray array = json.getAsJsonArray("entry");
17308      for (int i = 0; i < array.size(); i++) {
17309        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
17310      }
17311    }
17312    ;
17313    if (json.has("emptyReason"))
17314      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
17315  }
17316
17317  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner)
17318      throws IOException, FHIRFormatError {
17319    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
17320    parseListResourceListEntryComponentProperties(json, owner, res);
17321    return res;
17322  }
17323
17324  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner,
17325      ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
17326    parseBackboneElementProperties(json, res);
17327    if (json.has("flag"))
17328      res.setFlag(parseCodeableConcept(getJObject(json, "flag")));
17329    if (json.has("deleted"))
17330      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
17331    if (json.has("_deleted"))
17332      parseElementProperties(getJObject(json, "_deleted"), res.getDeletedElement());
17333    if (json.has("date"))
17334      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17335    if (json.has("_date"))
17336      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17337    if (json.has("item"))
17338      res.setItem(parseReference(getJObject(json, "item")));
17339  }
17340
17341  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
17342    Location res = new Location();
17343    parseLocationProperties(json, res);
17344    return res;
17345  }
17346
17347  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
17348    parseDomainResourceProperties(json, res);
17349    if (json.has("identifier")) {
17350      JsonArray array = json.getAsJsonArray("identifier");
17351      for (int i = 0; i < array.size(); i++) {
17352        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17353      }
17354    }
17355    ;
17356    if (json.has("status"))
17357      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL,
17358          new Location.LocationStatusEnumFactory()));
17359    if (json.has("_status"))
17360      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17361    if (json.has("operationalStatus"))
17362      res.setOperationalStatus(parseCoding(getJObject(json, "operationalStatus")));
17363    if (json.has("name"))
17364      res.setNameElement(parseString(json.get("name").getAsString()));
17365    if (json.has("_name"))
17366      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17367    if (json.has("alias")) {
17368      JsonArray array = json.getAsJsonArray("alias");
17369      for (int i = 0; i < array.size(); i++) {
17370        if (array.get(i).isJsonNull()) {
17371          res.getAlias().add(new StringType());
17372        } else {
17373          res.getAlias().add(parseString(array.get(i).getAsString()));
17374        }
17375      }
17376    }
17377    ;
17378    if (json.has("_alias")) {
17379      JsonArray array = json.getAsJsonArray("_alias");
17380      for (int i = 0; i < array.size(); i++) {
17381        if (i == res.getAlias().size())
17382          res.getAlias().add(parseString(null));
17383        if (array.get(i) instanceof JsonObject)
17384          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
17385      }
17386    }
17387    ;
17388    if (json.has("description"))
17389      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17390    if (json.has("_description"))
17391      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17392    if (json.has("mode"))
17393      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL,
17394          new Location.LocationModeEnumFactory()));
17395    if (json.has("_mode"))
17396      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
17397    if (json.has("type")) {
17398      JsonArray array = json.getAsJsonArray("type");
17399      for (int i = 0; i < array.size(); i++) {
17400        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17401      }
17402    }
17403    ;
17404    if (json.has("telecom")) {
17405      JsonArray array = json.getAsJsonArray("telecom");
17406      for (int i = 0; i < array.size(); i++) {
17407        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
17408      }
17409    }
17410    ;
17411    if (json.has("address"))
17412      res.setAddress(parseAddress(getJObject(json, "address")));
17413    if (json.has("physicalType"))
17414      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
17415    if (json.has("position"))
17416      res.setPosition(parseLocationLocationPositionComponent(getJObject(json, "position"), res));
17417    if (json.has("managingOrganization"))
17418      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
17419    if (json.has("partOf"))
17420      res.setPartOf(parseReference(getJObject(json, "partOf")));
17421    if (json.has("hoursOfOperation")) {
17422      JsonArray array = json.getAsJsonArray("hoursOfOperation");
17423      for (int i = 0; i < array.size(); i++) {
17424        res.getHoursOfOperation()
17425            .add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
17426      }
17427    }
17428    ;
17429    if (json.has("availabilityExceptions"))
17430      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
17431    if (json.has("_availabilityExceptions"))
17432      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
17433    if (json.has("endpoint")) {
17434      JsonArray array = json.getAsJsonArray("endpoint");
17435      for (int i = 0; i < array.size(); i++) {
17436        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
17437      }
17438    }
17439    ;
17440  }
17441
17442  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner)
17443      throws IOException, FHIRFormatError {
17444    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
17445    parseLocationLocationPositionComponentProperties(json, owner, res);
17446    return res;
17447  }
17448
17449  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner,
17450      Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
17451    parseBackboneElementProperties(json, res);
17452    if (json.has("longitude"))
17453      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
17454    if (json.has("_longitude"))
17455      parseElementProperties(getJObject(json, "_longitude"), res.getLongitudeElement());
17456    if (json.has("latitude"))
17457      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
17458    if (json.has("_latitude"))
17459      parseElementProperties(getJObject(json, "_latitude"), res.getLatitudeElement());
17460    if (json.has("altitude"))
17461      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
17462    if (json.has("_altitude"))
17463      parseElementProperties(getJObject(json, "_altitude"), res.getAltitudeElement());
17464  }
17465
17466  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json,
17467      Location owner) throws IOException, FHIRFormatError {
17468    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
17469    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
17470    return res;
17471  }
17472
17473  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner,
17474      Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
17475    parseBackboneElementProperties(json, res);
17476    if (json.has("daysOfWeek")) {
17477      JsonArray array = json.getAsJsonArray("daysOfWeek");
17478      for (int i = 0; i < array.size(); i++) {
17479        if (array.get(i).isJsonNull()) {
17480          res.getDaysOfWeek().add(new Enumeration<Location.DaysOfWeek>());
17481        } else {
17482          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL,
17483              new Location.DaysOfWeekEnumFactory()));
17484        }
17485      }
17486    }
17487    ;
17488    if (json.has("_daysOfWeek")) {
17489      JsonArray array = json.getAsJsonArray("_daysOfWeek");
17490      for (int i = 0; i < array.size(); i++) {
17491        if (i == res.getDaysOfWeek().size())
17492          res.getDaysOfWeek()
17493              .add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
17494        if (array.get(i) instanceof JsonObject)
17495          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
17496      }
17497    }
17498    ;
17499    if (json.has("allDay"))
17500      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
17501    if (json.has("_allDay"))
17502      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
17503    if (json.has("openingTime"))
17504      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
17505    if (json.has("_openingTime"))
17506      parseElementProperties(getJObject(json, "_openingTime"), res.getOpeningTimeElement());
17507    if (json.has("closingTime"))
17508      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
17509    if (json.has("_closingTime"))
17510      parseElementProperties(getJObject(json, "_closingTime"), res.getClosingTimeElement());
17511  }
17512
17513  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
17514    Measure res = new Measure();
17515    parseMeasureProperties(json, res);
17516    return res;
17517  }
17518
17519  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
17520    parseDomainResourceProperties(json, res);
17521    if (json.has("url"))
17522      res.setUrlElement(parseUri(json.get("url").getAsString()));
17523    if (json.has("_url"))
17524      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17525    if (json.has("identifier")) {
17526      JsonArray array = json.getAsJsonArray("identifier");
17527      for (int i = 0; i < array.size(); i++) {
17528        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17529      }
17530    }
17531    ;
17532    if (json.has("version"))
17533      res.setVersionElement(parseString(json.get("version").getAsString()));
17534    if (json.has("_version"))
17535      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17536    if (json.has("name"))
17537      res.setNameElement(parseString(json.get("name").getAsString()));
17538    if (json.has("_name"))
17539      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17540    if (json.has("title"))
17541      res.setTitleElement(parseString(json.get("title").getAsString()));
17542    if (json.has("_title"))
17543      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17544    if (json.has("subtitle"))
17545      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
17546    if (json.has("_subtitle"))
17547      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
17548    if (json.has("status"))
17549      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
17550          new Enumerations.PublicationStatusEnumFactory()));
17551    if (json.has("_status"))
17552      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17553    if (json.has("experimental"))
17554      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17555    if (json.has("_experimental"))
17556      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17557    Type subject = parseType("subject", json);
17558    if (subject != null)
17559      res.setSubject(subject);
17560    if (json.has("date"))
17561      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17562    if (json.has("_date"))
17563      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17564    if (json.has("publisher"))
17565      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17566    if (json.has("_publisher"))
17567      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17568    if (json.has("contact")) {
17569      JsonArray array = json.getAsJsonArray("contact");
17570      for (int i = 0; i < array.size(); i++) {
17571        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17572      }
17573    }
17574    ;
17575    if (json.has("description"))
17576      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17577    if (json.has("_description"))
17578      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17579    if (json.has("useContext")) {
17580      JsonArray array = json.getAsJsonArray("useContext");
17581      for (int i = 0; i < array.size(); i++) {
17582        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17583      }
17584    }
17585    ;
17586    if (json.has("jurisdiction")) {
17587      JsonArray array = json.getAsJsonArray("jurisdiction");
17588      for (int i = 0; i < array.size(); i++) {
17589        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17590      }
17591    }
17592    ;
17593    if (json.has("purpose"))
17594      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17595    if (json.has("_purpose"))
17596      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17597    if (json.has("usage"))
17598      res.setUsageElement(parseString(json.get("usage").getAsString()));
17599    if (json.has("_usage"))
17600      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
17601    if (json.has("copyright"))
17602      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17603    if (json.has("_copyright"))
17604      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17605    if (json.has("approvalDate"))
17606      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
17607    if (json.has("_approvalDate"))
17608      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
17609    if (json.has("lastReviewDate"))
17610      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
17611    if (json.has("_lastReviewDate"))
17612      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
17613    if (json.has("effectivePeriod"))
17614      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
17615    if (json.has("topic")) {
17616      JsonArray array = json.getAsJsonArray("topic");
17617      for (int i = 0; i < array.size(); i++) {
17618        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17619      }
17620    }
17621    ;
17622    if (json.has("author")) {
17623      JsonArray array = json.getAsJsonArray("author");
17624      for (int i = 0; i < array.size(); i++) {
17625        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
17626      }
17627    }
17628    ;
17629    if (json.has("editor")) {
17630      JsonArray array = json.getAsJsonArray("editor");
17631      for (int i = 0; i < array.size(); i++) {
17632        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
17633      }
17634    }
17635    ;
17636    if (json.has("reviewer")) {
17637      JsonArray array = json.getAsJsonArray("reviewer");
17638      for (int i = 0; i < array.size(); i++) {
17639        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
17640      }
17641    }
17642    ;
17643    if (json.has("endorser")) {
17644      JsonArray array = json.getAsJsonArray("endorser");
17645      for (int i = 0; i < array.size(); i++) {
17646        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
17647      }
17648    }
17649    ;
17650    if (json.has("relatedArtifact")) {
17651      JsonArray array = json.getAsJsonArray("relatedArtifact");
17652      for (int i = 0; i < array.size(); i++) {
17653        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
17654      }
17655    }
17656    ;
17657    if (json.has("library")) {
17658      JsonArray array = json.getAsJsonArray("library");
17659      for (int i = 0; i < array.size(); i++) {
17660        if (array.get(i).isJsonNull()) {
17661          res.getLibrary().add(new CanonicalType());
17662        } else {
17663          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
17664        }
17665      }
17666    }
17667    ;
17668    if (json.has("_library")) {
17669      JsonArray array = json.getAsJsonArray("_library");
17670      for (int i = 0; i < array.size(); i++) {
17671        if (i == res.getLibrary().size())
17672          res.getLibrary().add(parseCanonical(null));
17673        if (array.get(i) instanceof JsonObject)
17674          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
17675      }
17676    }
17677    ;
17678    if (json.has("disclaimer"))
17679      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
17680    if (json.has("_disclaimer"))
17681      parseElementProperties(getJObject(json, "_disclaimer"), res.getDisclaimerElement());
17682    if (json.has("scoring"))
17683      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
17684    if (json.has("compositeScoring"))
17685      res.setCompositeScoring(parseCodeableConcept(getJObject(json, "compositeScoring")));
17686    if (json.has("type")) {
17687      JsonArray array = json.getAsJsonArray("type");
17688      for (int i = 0; i < array.size(); i++) {
17689        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17690      }
17691    }
17692    ;
17693    if (json.has("riskAdjustment"))
17694      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
17695    if (json.has("_riskAdjustment"))
17696      parseElementProperties(getJObject(json, "_riskAdjustment"), res.getRiskAdjustmentElement());
17697    if (json.has("rateAggregation"))
17698      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
17699    if (json.has("_rateAggregation"))
17700      parseElementProperties(getJObject(json, "_rateAggregation"), res.getRateAggregationElement());
17701    if (json.has("rationale"))
17702      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
17703    if (json.has("_rationale"))
17704      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
17705    if (json.has("clinicalRecommendationStatement"))
17706      res.setClinicalRecommendationStatementElement(
17707          parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
17708    if (json.has("_clinicalRecommendationStatement"))
17709      parseElementProperties(getJObject(json, "_clinicalRecommendationStatement"),
17710          res.getClinicalRecommendationStatementElement());
17711    if (json.has("improvementNotation"))
17712      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
17713    if (json.has("definition")) {
17714      JsonArray array = json.getAsJsonArray("definition");
17715      for (int i = 0; i < array.size(); i++) {
17716        if (array.get(i).isJsonNull()) {
17717          res.getDefinition().add(new MarkdownType());
17718        } else {
17719          res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
17720        }
17721      }
17722    }
17723    ;
17724    if (json.has("_definition")) {
17725      JsonArray array = json.getAsJsonArray("_definition");
17726      for (int i = 0; i < array.size(); i++) {
17727        if (i == res.getDefinition().size())
17728          res.getDefinition().add(parseMarkdown(null));
17729        if (array.get(i) instanceof JsonObject)
17730          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
17731      }
17732    }
17733    ;
17734    if (json.has("guidance"))
17735      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
17736    if (json.has("_guidance"))
17737      parseElementProperties(getJObject(json, "_guidance"), res.getGuidanceElement());
17738    if (json.has("group")) {
17739      JsonArray array = json.getAsJsonArray("group");
17740      for (int i = 0; i < array.size(); i++) {
17741        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
17742      }
17743    }
17744    ;
17745    if (json.has("supplementalData")) {
17746      JsonArray array = json.getAsJsonArray("supplementalData");
17747      for (int i = 0; i < array.size(); i++) {
17748        res.getSupplementalData()
17749            .add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
17750      }
17751    }
17752    ;
17753  }
17754
17755  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner)
17756      throws IOException, FHIRFormatError {
17757    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
17758    parseMeasureMeasureGroupComponentProperties(json, owner, res);
17759    return res;
17760  }
17761
17762  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner,
17763      Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
17764    parseBackboneElementProperties(json, res);
17765    if (json.has("code"))
17766      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17767    if (json.has("description"))
17768      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17769    if (json.has("_description"))
17770      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17771    if (json.has("population")) {
17772      JsonArray array = json.getAsJsonArray("population");
17773      for (int i = 0; i < array.size(); i++) {
17774        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
17775      }
17776    }
17777    ;
17778    if (json.has("stratifier")) {
17779      JsonArray array = json.getAsJsonArray("stratifier");
17780      for (int i = 0; i < array.size(); i++) {
17781        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
17782      }
17783    }
17784    ;
17785  }
17786
17787  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json,
17788      Measure owner) throws IOException, FHIRFormatError {
17789    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
17790    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
17791    return res;
17792  }
17793
17794  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner,
17795      Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
17796    parseBackboneElementProperties(json, res);
17797    if (json.has("code"))
17798      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17799    if (json.has("description"))
17800      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17801    if (json.has("_description"))
17802      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17803    if (json.has("criteria"))
17804      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17805  }
17806
17807  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json,
17808      Measure owner) throws IOException, FHIRFormatError {
17809    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
17810    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
17811    return res;
17812  }
17813
17814  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner,
17815      Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
17816    parseBackboneElementProperties(json, res);
17817    if (json.has("code"))
17818      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17819    if (json.has("description"))
17820      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17821    if (json.has("_description"))
17822      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17823    if (json.has("criteria"))
17824      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17825    if (json.has("component")) {
17826      JsonArray array = json.getAsJsonArray("component");
17827      for (int i = 0; i < array.size(); i++) {
17828        res.getComponent()
17829            .add(parseMeasureMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject(), owner));
17830      }
17831    }
17832    ;
17833  }
17834
17835  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureMeasureGroupStratifierComponentComponent(
17836      JsonObject json, Measure owner) throws IOException, FHIRFormatError {
17837    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
17838    parseMeasureMeasureGroupStratifierComponentComponentProperties(json, owner, res);
17839    return res;
17840  }
17841
17842  protected void parseMeasureMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure owner,
17843      Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
17844    parseBackboneElementProperties(json, res);
17845    if (json.has("code"))
17846      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17847    if (json.has("description"))
17848      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17849    if (json.has("_description"))
17850      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17851    if (json.has("criteria"))
17852      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17853  }
17854
17855  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json,
17856      Measure owner) throws IOException, FHIRFormatError {
17857    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
17858    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
17859    return res;
17860  }
17861
17862  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner,
17863      Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
17864    parseBackboneElementProperties(json, res);
17865    if (json.has("code"))
17866      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17867    if (json.has("usage")) {
17868      JsonArray array = json.getAsJsonArray("usage");
17869      for (int i = 0; i < array.size(); i++) {
17870        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17871      }
17872    }
17873    ;
17874    if (json.has("description"))
17875      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17876    if (json.has("_description"))
17877      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17878    if (json.has("criteria"))
17879      res.setCriteria(parseExpression(getJObject(json, "criteria")));
17880  }
17881
17882  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
17883    MeasureReport res = new MeasureReport();
17884    parseMeasureReportProperties(json, res);
17885    return res;
17886  }
17887
17888  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
17889    parseDomainResourceProperties(json, res);
17890    if (json.has("identifier")) {
17891      JsonArray array = json.getAsJsonArray("identifier");
17892      for (int i = 0; i < array.size(); i++) {
17893        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17894      }
17895    }
17896    ;
17897    if (json.has("status"))
17898      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL,
17899          new MeasureReport.MeasureReportStatusEnumFactory()));
17900    if (json.has("_status"))
17901      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17902    if (json.has("type"))
17903      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL,
17904          new MeasureReport.MeasureReportTypeEnumFactory()));
17905    if (json.has("_type"))
17906      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17907    if (json.has("measure"))
17908      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
17909    if (json.has("_measure"))
17910      parseElementProperties(getJObject(json, "_measure"), res.getMeasureElement());
17911    if (json.has("subject"))
17912      res.setSubject(parseReference(getJObject(json, "subject")));
17913    if (json.has("date"))
17914      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17915    if (json.has("_date"))
17916      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17917    if (json.has("reporter"))
17918      res.setReporter(parseReference(getJObject(json, "reporter")));
17919    if (json.has("period"))
17920      res.setPeriod(parsePeriod(getJObject(json, "period")));
17921    if (json.has("improvementNotation"))
17922      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
17923    if (json.has("group")) {
17924      JsonArray array = json.getAsJsonArray("group");
17925      for (int i = 0; i < array.size(); i++) {
17926        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
17927      }
17928    }
17929    ;
17930    if (json.has("evaluatedResource")) {
17931      JsonArray array = json.getAsJsonArray("evaluatedResource");
17932      for (int i = 0; i < array.size(); i++) {
17933        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
17934      }
17935    }
17936    ;
17937  }
17938
17939  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json,
17940      MeasureReport owner) throws IOException, FHIRFormatError {
17941    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
17942    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
17943    return res;
17944  }
17945
17946  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner,
17947      MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
17948    parseBackboneElementProperties(json, res);
17949    if (json.has("code"))
17950      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17951    if (json.has("population")) {
17952      JsonArray array = json.getAsJsonArray("population");
17953      for (int i = 0; i < array.size(); i++) {
17954        res.getPopulation()
17955            .add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
17956      }
17957    }
17958    ;
17959    if (json.has("measureScore"))
17960      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
17961    if (json.has("stratifier")) {
17962      JsonArray array = json.getAsJsonArray("stratifier");
17963      for (int i = 0; i < array.size(); i++) {
17964        res.getStratifier()
17965            .add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
17966      }
17967    }
17968    ;
17969  }
17970
17971  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(
17972      JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
17973    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
17974    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
17975    return res;
17976  }
17977
17978  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner,
17979      MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
17980    parseBackboneElementProperties(json, res);
17981    if (json.has("code"))
17982      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17983    if (json.has("count"))
17984      res.setCountElement(parseInteger(json.get("count").getAsLong()));
17985    if (json.has("_count"))
17986      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
17987    if (json.has("subjectResults"))
17988      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
17989  }
17990
17991  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(
17992      JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
17993    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
17994    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
17995    return res;
17996  }
17997
17998  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner,
17999      MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
18000    parseBackboneElementProperties(json, res);
18001    if (json.has("code")) {
18002      JsonArray array = json.getAsJsonArray("code");
18003      for (int i = 0; i < array.size(); i++) {
18004        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18005      }
18006    }
18007    ;
18008    if (json.has("stratum")) {
18009      JsonArray array = json.getAsJsonArray("stratum");
18010      for (int i = 0; i < array.size(); i++) {
18011        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
18012      }
18013    }
18014    ;
18015  }
18016
18017  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json,
18018      MeasureReport owner) throws IOException, FHIRFormatError {
18019    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
18020    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
18021    return res;
18022  }
18023
18024  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner,
18025      MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
18026    parseBackboneElementProperties(json, res);
18027    if (json.has("value"))
18028      res.setValue(parseCodeableConcept(getJObject(json, "value")));
18029    if (json.has("component")) {
18030      JsonArray array = json.getAsJsonArray("component");
18031      for (int i = 0; i < array.size(); i++) {
18032        res.getComponent()
18033            .add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject(), owner));
18034      }
18035    }
18036    ;
18037    if (json.has("population")) {
18038      JsonArray array = json.getAsJsonArray("population");
18039      for (int i = 0; i < array.size(); i++) {
18040        res.getPopulation()
18041            .add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
18042      }
18043    }
18044    ;
18045    if (json.has("measureScore"))
18046      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
18047  }
18048
18049  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(
18050      JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
18051    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
18052    parseMeasureReportStratifierGroupComponentComponentProperties(json, owner, res);
18053    return res;
18054  }
18055
18056  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport owner,
18057      MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
18058    parseBackboneElementProperties(json, res);
18059    if (json.has("code"))
18060      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18061    if (json.has("value"))
18062      res.setValue(parseCodeableConcept(getJObject(json, "value")));
18063  }
18064
18065  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(
18066      JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
18067    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
18068    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
18069    return res;
18070  }
18071
18072  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner,
18073      MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
18074    parseBackboneElementProperties(json, res);
18075    if (json.has("code"))
18076      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18077    if (json.has("count"))
18078      res.setCountElement(parseInteger(json.get("count").getAsLong()));
18079    if (json.has("_count"))
18080      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
18081    if (json.has("subjectResults"))
18082      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
18083  }
18084
18085  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
18086    Media res = new Media();
18087    parseMediaProperties(json, res);
18088    return res;
18089  }
18090
18091  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
18092    parseDomainResourceProperties(json, res);
18093    if (json.has("identifier")) {
18094      JsonArray array = json.getAsJsonArray("identifier");
18095      for (int i = 0; i < array.size(); i++) {
18096        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18097      }
18098    }
18099    ;
18100    if (json.has("basedOn")) {
18101      JsonArray array = json.getAsJsonArray("basedOn");
18102      for (int i = 0; i < array.size(); i++) {
18103        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18104      }
18105    }
18106    ;
18107    if (json.has("partOf")) {
18108      JsonArray array = json.getAsJsonArray("partOf");
18109      for (int i = 0; i < array.size(); i++) {
18110        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18111      }
18112    }
18113    ;
18114    if (json.has("status"))
18115      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Media.MediaStatus.NULL,
18116          new Media.MediaStatusEnumFactory()));
18117    if (json.has("_status"))
18118      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18119    if (json.has("type"))
18120      res.setType(parseCodeableConcept(getJObject(json, "type")));
18121    if (json.has("modality"))
18122      res.setModality(parseCodeableConcept(getJObject(json, "modality")));
18123    if (json.has("view"))
18124      res.setView(parseCodeableConcept(getJObject(json, "view")));
18125    if (json.has("subject"))
18126      res.setSubject(parseReference(getJObject(json, "subject")));
18127    if (json.has("encounter"))
18128      res.setEncounter(parseReference(getJObject(json, "encounter")));
18129    Type created = parseType("created", json);
18130    if (created != null)
18131      res.setCreated(created);
18132    if (json.has("issued"))
18133      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
18134    if (json.has("_issued"))
18135      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
18136    if (json.has("operator"))
18137      res.setOperator(parseReference(getJObject(json, "operator")));
18138    if (json.has("reasonCode")) {
18139      JsonArray array = json.getAsJsonArray("reasonCode");
18140      for (int i = 0; i < array.size(); i++) {
18141        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18142      }
18143    }
18144    ;
18145    if (json.has("bodySite"))
18146      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
18147    if (json.has("deviceName"))
18148      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
18149    if (json.has("_deviceName"))
18150      parseElementProperties(getJObject(json, "_deviceName"), res.getDeviceNameElement());
18151    if (json.has("device"))
18152      res.setDevice(parseReference(getJObject(json, "device")));
18153    if (json.has("height"))
18154      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
18155    if (json.has("_height"))
18156      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
18157    if (json.has("width"))
18158      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
18159    if (json.has("_width"))
18160      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
18161    if (json.has("frames"))
18162      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
18163    if (json.has("_frames"))
18164      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
18165    if (json.has("duration"))
18166      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
18167    if (json.has("_duration"))
18168      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
18169    if (json.has("content"))
18170      res.setContent(parseAttachment(getJObject(json, "content")));
18171    if (json.has("note")) {
18172      JsonArray array = json.getAsJsonArray("note");
18173      for (int i = 0; i < array.size(); i++) {
18174        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18175      }
18176    }
18177    ;
18178  }
18179
18180  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
18181    Medication res = new Medication();
18182    parseMedicationProperties(json, res);
18183    return res;
18184  }
18185
18186  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
18187    parseDomainResourceProperties(json, res);
18188    if (json.has("identifier")) {
18189      JsonArray array = json.getAsJsonArray("identifier");
18190      for (int i = 0; i < array.size(); i++) {
18191        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18192      }
18193    }
18194    ;
18195    if (json.has("code"))
18196      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18197    if (json.has("status"))
18198      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL,
18199          new Medication.MedicationStatusEnumFactory()));
18200    if (json.has("_status"))
18201      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18202    if (json.has("manufacturer"))
18203      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
18204    if (json.has("form"))
18205      res.setForm(parseCodeableConcept(getJObject(json, "form")));
18206    if (json.has("amount"))
18207      res.setAmount(parseRatio(getJObject(json, "amount")));
18208    if (json.has("ingredient")) {
18209      JsonArray array = json.getAsJsonArray("ingredient");
18210      for (int i = 0; i < array.size(); i++) {
18211        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
18212      }
18213    }
18214    ;
18215    if (json.has("batch"))
18216      res.setBatch(parseMedicationMedicationBatchComponent(getJObject(json, "batch"), res));
18217  }
18218
18219  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json,
18220      Medication owner) throws IOException, FHIRFormatError {
18221    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
18222    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
18223    return res;
18224  }
18225
18226  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner,
18227      Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
18228    parseBackboneElementProperties(json, res);
18229    Type item = parseType("item", json);
18230    if (item != null)
18231      res.setItem(item);
18232    if (json.has("isActive"))
18233      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
18234    if (json.has("_isActive"))
18235      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
18236    if (json.has("strength"))
18237      res.setStrength(parseRatio(getJObject(json, "strength")));
18238  }
18239
18240  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json,
18241      Medication owner) throws IOException, FHIRFormatError {
18242    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
18243    parseMedicationMedicationBatchComponentProperties(json, owner, res);
18244    return res;
18245  }
18246
18247  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner,
18248      Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
18249    parseBackboneElementProperties(json, res);
18250    if (json.has("lotNumber"))
18251      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
18252    if (json.has("_lotNumber"))
18253      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
18254    if (json.has("expirationDate"))
18255      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
18256    if (json.has("_expirationDate"))
18257      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
18258  }
18259
18260  protected MedicationAdministration parseMedicationAdministration(JsonObject json)
18261      throws IOException, FHIRFormatError {
18262    MedicationAdministration res = new MedicationAdministration();
18263    parseMedicationAdministrationProperties(json, res);
18264    return res;
18265  }
18266
18267  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res)
18268      throws IOException, FHIRFormatError {
18269    parseDomainResourceProperties(json, res);
18270    if (json.has("identifier")) {
18271      JsonArray array = json.getAsJsonArray("identifier");
18272      for (int i = 0; i < array.size(); i++) {
18273        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18274      }
18275    }
18276    ;
18277    if (json.has("instantiates")) {
18278      JsonArray array = json.getAsJsonArray("instantiates");
18279      for (int i = 0; i < array.size(); i++) {
18280        if (array.get(i).isJsonNull()) {
18281          res.getInstantiates().add(new UriType());
18282        } else {
18283          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
18284        }
18285      }
18286    }
18287    ;
18288    if (json.has("_instantiates")) {
18289      JsonArray array = json.getAsJsonArray("_instantiates");
18290      for (int i = 0; i < array.size(); i++) {
18291        if (i == res.getInstantiates().size())
18292          res.getInstantiates().add(parseUri(null));
18293        if (array.get(i) instanceof JsonObject)
18294          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
18295      }
18296    }
18297    ;
18298    if (json.has("partOf")) {
18299      JsonArray array = json.getAsJsonArray("partOf");
18300      for (int i = 0; i < array.size(); i++) {
18301        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18302      }
18303    }
18304    ;
18305    if (json.has("status"))
18306      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
18307          MedicationAdministration.MedicationAdministrationStatus.NULL,
18308          new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
18309    if (json.has("_status"))
18310      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18311    if (json.has("statusReason")) {
18312      JsonArray array = json.getAsJsonArray("statusReason");
18313      for (int i = 0; i < array.size(); i++) {
18314        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18315      }
18316    }
18317    ;
18318    if (json.has("category"))
18319      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
18320    Type medication = parseType("medication", json);
18321    if (medication != null)
18322      res.setMedication(medication);
18323    if (json.has("subject"))
18324      res.setSubject(parseReference(getJObject(json, "subject")));
18325    if (json.has("context"))
18326      res.setContext(parseReference(getJObject(json, "context")));
18327    if (json.has("supportingInformation")) {
18328      JsonArray array = json.getAsJsonArray("supportingInformation");
18329      for (int i = 0; i < array.size(); i++) {
18330        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
18331      }
18332    }
18333    ;
18334    Type effective = parseType("effective", json);
18335    if (effective != null)
18336      res.setEffective(effective);
18337    if (json.has("performer")) {
18338      JsonArray array = json.getAsJsonArray("performer");
18339      for (int i = 0; i < array.size(); i++) {
18340        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(
18341            array.get(i).getAsJsonObject(), res));
18342      }
18343    }
18344    ;
18345    if (json.has("reasonCode")) {
18346      JsonArray array = json.getAsJsonArray("reasonCode");
18347      for (int i = 0; i < array.size(); i++) {
18348        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18349      }
18350    }
18351    ;
18352    if (json.has("reasonReference")) {
18353      JsonArray array = json.getAsJsonArray("reasonReference");
18354      for (int i = 0; i < array.size(); i++) {
18355        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
18356      }
18357    }
18358    ;
18359    if (json.has("request"))
18360      res.setRequest(parseReference(getJObject(json, "request")));
18361    if (json.has("device")) {
18362      JsonArray array = json.getAsJsonArray("device");
18363      for (int i = 0; i < array.size(); i++) {
18364        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
18365      }
18366    }
18367    ;
18368    if (json.has("note")) {
18369      JsonArray array = json.getAsJsonArray("note");
18370      for (int i = 0; i < array.size(); i++) {
18371        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18372      }
18373    }
18374    ;
18375    if (json.has("dosage"))
18376      res.setDosage(
18377          parseMedicationAdministrationMedicationAdministrationDosageComponent(getJObject(json, "dosage"), res));
18378    if (json.has("eventHistory")) {
18379      JsonArray array = json.getAsJsonArray("eventHistory");
18380      for (int i = 0; i < array.size(); i++) {
18381        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
18382      }
18383    }
18384    ;
18385  }
18386
18387  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(
18388      JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
18389    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
18390    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
18391    return res;
18392  }
18393
18394  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json,
18395      MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res)
18396      throws IOException, FHIRFormatError {
18397    parseBackboneElementProperties(json, res);
18398    if (json.has("function"))
18399      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
18400    if (json.has("actor"))
18401      res.setActor(parseReference(getJObject(json, "actor")));
18402  }
18403
18404  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(
18405      JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
18406    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
18407    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
18408    return res;
18409  }
18410
18411  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json,
18412      MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res)
18413      throws IOException, FHIRFormatError {
18414    parseBackboneElementProperties(json, res);
18415    if (json.has("text"))
18416      res.setTextElement(parseString(json.get("text").getAsString()));
18417    if (json.has("_text"))
18418      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
18419    if (json.has("site"))
18420      res.setSite(parseCodeableConcept(getJObject(json, "site")));
18421    if (json.has("route"))
18422      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
18423    if (json.has("method"))
18424      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
18425    if (json.has("dose"))
18426      res.setDose(parseQuantity(getJObject(json, "dose")));
18427    Type rate = parseType("rate", json);
18428    if (rate != null)
18429      res.setRate(rate);
18430  }
18431
18432  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
18433    MedicationDispense res = new MedicationDispense();
18434    parseMedicationDispenseProperties(json, res);
18435    return res;
18436  }
18437
18438  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res)
18439      throws IOException, FHIRFormatError {
18440    parseDomainResourceProperties(json, res);
18441    if (json.has("identifier")) {
18442      JsonArray array = json.getAsJsonArray("identifier");
18443      for (int i = 0; i < array.size(); i++) {
18444        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18445      }
18446    }
18447    ;
18448    if (json.has("partOf")) {
18449      JsonArray array = json.getAsJsonArray("partOf");
18450      for (int i = 0; i < array.size(); i++) {
18451        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18452      }
18453    }
18454    ;
18455    if (json.has("status"))
18456      res.setStatusElement(
18457          parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL,
18458              new MedicationDispense.MedicationDispenseStatusEnumFactory()));
18459    if (json.has("_status"))
18460      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18461    Type statusReason = parseType("statusReason", json);
18462    if (statusReason != null)
18463      res.setStatusReason(statusReason);
18464    if (json.has("category"))
18465      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
18466    Type medication = parseType("medication", json);
18467    if (medication != null)
18468      res.setMedication(medication);
18469    if (json.has("subject"))
18470      res.setSubject(parseReference(getJObject(json, "subject")));
18471    if (json.has("context"))
18472      res.setContext(parseReference(getJObject(json, "context")));
18473    if (json.has("supportingInformation")) {
18474      JsonArray array = json.getAsJsonArray("supportingInformation");
18475      for (int i = 0; i < array.size(); i++) {
18476        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
18477      }
18478    }
18479    ;
18480    if (json.has("performer")) {
18481      JsonArray array = json.getAsJsonArray("performer");
18482      for (int i = 0; i < array.size(); i++) {
18483        res.getPerformer()
18484            .add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
18485      }
18486    }
18487    ;
18488    if (json.has("location"))
18489      res.setLocation(parseReference(getJObject(json, "location")));
18490    if (json.has("authorizingPrescription")) {
18491      JsonArray array = json.getAsJsonArray("authorizingPrescription");
18492      for (int i = 0; i < array.size(); i++) {
18493        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
18494      }
18495    }
18496    ;
18497    if (json.has("type"))
18498      res.setType(parseCodeableConcept(getJObject(json, "type")));
18499    if (json.has("quantity"))
18500      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18501    if (json.has("daysSupply"))
18502      res.setDaysSupply(parseQuantity(getJObject(json, "daysSupply")));
18503    if (json.has("whenPrepared"))
18504      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
18505    if (json.has("_whenPrepared"))
18506      parseElementProperties(getJObject(json, "_whenPrepared"), res.getWhenPreparedElement());
18507    if (json.has("whenHandedOver"))
18508      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
18509    if (json.has("_whenHandedOver"))
18510      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
18511    if (json.has("destination"))
18512      res.setDestination(parseReference(getJObject(json, "destination")));
18513    if (json.has("receiver")) {
18514      JsonArray array = json.getAsJsonArray("receiver");
18515      for (int i = 0; i < array.size(); i++) {
18516        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
18517      }
18518    }
18519    ;
18520    if (json.has("note")) {
18521      JsonArray array = json.getAsJsonArray("note");
18522      for (int i = 0; i < array.size(); i++) {
18523        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18524      }
18525    }
18526    ;
18527    if (json.has("dosageInstruction")) {
18528      JsonArray array = json.getAsJsonArray("dosageInstruction");
18529      for (int i = 0; i < array.size(); i++) {
18530        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
18531      }
18532    }
18533    ;
18534    if (json.has("substitution"))
18535      res.setSubstitution(
18536          parseMedicationDispenseMedicationDispenseSubstitutionComponent(getJObject(json, "substitution"), res));
18537    if (json.has("detectedIssue")) {
18538      JsonArray array = json.getAsJsonArray("detectedIssue");
18539      for (int i = 0; i < array.size(); i++) {
18540        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
18541      }
18542    }
18543    ;
18544    if (json.has("eventHistory")) {
18545      JsonArray array = json.getAsJsonArray("eventHistory");
18546      for (int i = 0; i < array.size(); i++) {
18547        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
18548      }
18549    }
18550    ;
18551  }
18552
18553  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(
18554      JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
18555    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
18556    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
18557    return res;
18558  }
18559
18560  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json,
18561      MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res)
18562      throws IOException, FHIRFormatError {
18563    parseBackboneElementProperties(json, res);
18564    if (json.has("function"))
18565      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
18566    if (json.has("actor"))
18567      res.setActor(parseReference(getJObject(json, "actor")));
18568  }
18569
18570  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(
18571      JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
18572    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
18573    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
18574    return res;
18575  }
18576
18577  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json,
18578      MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res)
18579      throws IOException, FHIRFormatError {
18580    parseBackboneElementProperties(json, res);
18581    if (json.has("wasSubstituted"))
18582      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
18583    if (json.has("_wasSubstituted"))
18584      parseElementProperties(getJObject(json, "_wasSubstituted"), res.getWasSubstitutedElement());
18585    if (json.has("type"))
18586      res.setType(parseCodeableConcept(getJObject(json, "type")));
18587    if (json.has("reason")) {
18588      JsonArray array = json.getAsJsonArray("reason");
18589      for (int i = 0; i < array.size(); i++) {
18590        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18591      }
18592    }
18593    ;
18594    if (json.has("responsibleParty")) {
18595      JsonArray array = json.getAsJsonArray("responsibleParty");
18596      for (int i = 0; i < array.size(); i++) {
18597        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
18598      }
18599    }
18600    ;
18601  }
18602
18603  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
18604    MedicationKnowledge res = new MedicationKnowledge();
18605    parseMedicationKnowledgeProperties(json, res);
18606    return res;
18607  }
18608
18609  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res)
18610      throws IOException, FHIRFormatError {
18611    parseDomainResourceProperties(json, res);
18612    if (json.has("code"))
18613      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18614    if (json.has("status"))
18615      res.setStatusElement(
18616          parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatus.NULL,
18617              new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory()));
18618    if (json.has("_status"))
18619      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18620    if (json.has("manufacturer"))
18621      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
18622    if (json.has("doseForm"))
18623      res.setDoseForm(parseCodeableConcept(getJObject(json, "doseForm")));
18624    if (json.has("amount"))
18625      res.setAmount(parseQuantity(getJObject(json, "amount")));
18626    if (json.has("synonym")) {
18627      JsonArray array = json.getAsJsonArray("synonym");
18628      for (int i = 0; i < array.size(); i++) {
18629        if (array.get(i).isJsonNull()) {
18630          res.getSynonym().add(new StringType());
18631        } else {
18632          res.getSynonym().add(parseString(array.get(i).getAsString()));
18633        }
18634      }
18635    }
18636    ;
18637    if (json.has("_synonym")) {
18638      JsonArray array = json.getAsJsonArray("_synonym");
18639      for (int i = 0; i < array.size(); i++) {
18640        if (i == res.getSynonym().size())
18641          res.getSynonym().add(parseString(null));
18642        if (array.get(i) instanceof JsonObject)
18643          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
18644      }
18645    }
18646    ;
18647    if (json.has("relatedMedicationKnowledge")) {
18648      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
18649      for (int i = 0; i < array.size(); i++) {
18650        res.getRelatedMedicationKnowledge()
18651            .add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(
18652                array.get(i).getAsJsonObject(), res));
18653      }
18654    }
18655    ;
18656    if (json.has("associatedMedication")) {
18657      JsonArray array = json.getAsJsonArray("associatedMedication");
18658      for (int i = 0; i < array.size(); i++) {
18659        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
18660      }
18661    }
18662    ;
18663    if (json.has("productType")) {
18664      JsonArray array = json.getAsJsonArray("productType");
18665      for (int i = 0; i < array.size(); i++) {
18666        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18667      }
18668    }
18669    ;
18670    if (json.has("monograph")) {
18671      JsonArray array = json.getAsJsonArray("monograph");
18672      for (int i = 0; i < array.size(); i++) {
18673        res.getMonograph()
18674            .add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
18675      }
18676    }
18677    ;
18678    if (json.has("ingredient")) {
18679      JsonArray array = json.getAsJsonArray("ingredient");
18680      for (int i = 0; i < array.size(); i++) {
18681        res.getIngredient()
18682            .add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
18683      }
18684    }
18685    ;
18686    if (json.has("preparationInstruction"))
18687      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
18688    if (json.has("_preparationInstruction"))
18689      parseElementProperties(getJObject(json, "_preparationInstruction"), res.getPreparationInstructionElement());
18690    if (json.has("intendedRoute")) {
18691      JsonArray array = json.getAsJsonArray("intendedRoute");
18692      for (int i = 0; i < array.size(); i++) {
18693        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18694      }
18695    }
18696    ;
18697    if (json.has("cost")) {
18698      JsonArray array = json.getAsJsonArray("cost");
18699      for (int i = 0; i < array.size(); i++) {
18700        res.getCost()
18701            .add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
18702      }
18703    }
18704    ;
18705    if (json.has("monitoringProgram")) {
18706      JsonArray array = json.getAsJsonArray("monitoringProgram");
18707      for (int i = 0; i < array.size(); i++) {
18708        res.getMonitoringProgram().add(
18709            parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
18710      }
18711    }
18712    ;
18713    if (json.has("administrationGuidelines")) {
18714      JsonArray array = json.getAsJsonArray("administrationGuidelines");
18715      for (int i = 0; i < array.size(); i++) {
18716        res.getAdministrationGuidelines().add(
18717            parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject(),
18718                res));
18719      }
18720    }
18721    ;
18722    if (json.has("medicineClassification")) {
18723      JsonArray array = json.getAsJsonArray("medicineClassification");
18724      for (int i = 0; i < array.size(); i++) {
18725        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(
18726            array.get(i).getAsJsonObject(), res));
18727      }
18728    }
18729    ;
18730    if (json.has("packaging"))
18731      res.setPackaging(
18732          parseMedicationKnowledgeMedicationKnowledgePackagingComponent(getJObject(json, "packaging"), res));
18733    if (json.has("drugCharacteristic")) {
18734      JsonArray array = json.getAsJsonArray("drugCharacteristic");
18735      for (int i = 0; i < array.size(); i++) {
18736        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(
18737            array.get(i).getAsJsonObject(), res));
18738      }
18739    }
18740    ;
18741    if (json.has("contraindication")) {
18742      JsonArray array = json.getAsJsonArray("contraindication");
18743      for (int i = 0; i < array.size(); i++) {
18744        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
18745      }
18746    }
18747    ;
18748    if (json.has("regulatory")) {
18749      JsonArray array = json.getAsJsonArray("regulatory");
18750      for (int i = 0; i < array.size(); i++) {
18751        res.getRegulatory()
18752            .add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject(), res));
18753      }
18754    }
18755    ;
18756    if (json.has("kinetics")) {
18757      JsonArray array = json.getAsJsonArray("kinetics");
18758      for (int i = 0; i < array.size(); i++) {
18759        res.getKinetics()
18760            .add(parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(array.get(i).getAsJsonObject(), res));
18761      }
18762    }
18763    ;
18764  }
18765
18766  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(
18767      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18768    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
18769    parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, owner, res);
18770    return res;
18771  }
18772
18773  protected void parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(
18774      JsonObject json, MedicationKnowledge owner,
18775      MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res)
18776      throws IOException, FHIRFormatError {
18777    parseBackboneElementProperties(json, res);
18778    if (json.has("type"))
18779      res.setType(parseCodeableConcept(getJObject(json, "type")));
18780    if (json.has("reference")) {
18781      JsonArray array = json.getAsJsonArray("reference");
18782      for (int i = 0; i < array.size(); i++) {
18783        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
18784      }
18785    }
18786    ;
18787  }
18788
18789  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(
18790      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18791    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
18792    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
18793    return res;
18794  }
18795
18796  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json,
18797      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res)
18798      throws IOException, FHIRFormatError {
18799    parseBackboneElementProperties(json, res);
18800    if (json.has("type"))
18801      res.setType(parseCodeableConcept(getJObject(json, "type")));
18802    if (json.has("source"))
18803      res.setSource(parseReference(getJObject(json, "source")));
18804  }
18805
18806  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(
18807      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18808    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
18809    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
18810    return res;
18811  }
18812
18813  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json,
18814      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res)
18815      throws IOException, FHIRFormatError {
18816    parseBackboneElementProperties(json, res);
18817    Type item = parseType("item", json);
18818    if (item != null)
18819      res.setItem(item);
18820    if (json.has("isActive"))
18821      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
18822    if (json.has("_isActive"))
18823      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
18824    if (json.has("strength"))
18825      res.setStrength(parseRatio(getJObject(json, "strength")));
18826  }
18827
18828  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(
18829      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18830    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
18831    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
18832    return res;
18833  }
18834
18835  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json,
18836      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res)
18837      throws IOException, FHIRFormatError {
18838    parseBackboneElementProperties(json, res);
18839    if (json.has("type"))
18840      res.setType(parseCodeableConcept(getJObject(json, "type")));
18841    if (json.has("source"))
18842      res.setSourceElement(parseString(json.get("source").getAsString()));
18843    if (json.has("_source"))
18844      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
18845    if (json.has("cost"))
18846      res.setCost(parseMoney(getJObject(json, "cost")));
18847  }
18848
18849  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(
18850      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18851    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
18852    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
18853    return res;
18854  }
18855
18856  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json,
18857      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res)
18858      throws IOException, FHIRFormatError {
18859    parseBackboneElementProperties(json, res);
18860    if (json.has("type"))
18861      res.setType(parseCodeableConcept(getJObject(json, "type")));
18862    if (json.has("name"))
18863      res.setNameElement(parseString(json.get("name").getAsString()));
18864    if (json.has("_name"))
18865      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18866  }
18867
18868  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(
18869      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18870    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
18871    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, owner, res);
18872    return res;
18873  }
18874
18875  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json,
18876      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res)
18877      throws IOException, FHIRFormatError {
18878    parseBackboneElementProperties(json, res);
18879    if (json.has("dosage")) {
18880      JsonArray array = json.getAsJsonArray("dosage");
18881      for (int i = 0; i < array.size(); i++) {
18882        res.getDosage().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(
18883            array.get(i).getAsJsonObject(), owner));
18884      }
18885    }
18886    ;
18887    Type indication = parseType("indication", json);
18888    if (indication != null)
18889      res.setIndication(indication);
18890    if (json.has("patientCharacteristics")) {
18891      JsonArray array = json.getAsJsonArray("patientCharacteristics");
18892      for (int i = 0; i < array.size(); i++) {
18893        res.getPatientCharacteristics()
18894            .add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(
18895                array.get(i).getAsJsonObject(), owner));
18896      }
18897    }
18898    ;
18899  }
18900
18901  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(
18902      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18903    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
18904    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(json, owner, res);
18905    return res;
18906  }
18907
18908  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(
18909      JsonObject json, MedicationKnowledge owner,
18910      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res)
18911      throws IOException, FHIRFormatError {
18912    parseBackboneElementProperties(json, res);
18913    if (json.has("type"))
18914      res.setType(parseCodeableConcept(getJObject(json, "type")));
18915    if (json.has("dosage")) {
18916      JsonArray array = json.getAsJsonArray("dosage");
18917      for (int i = 0; i < array.size(); i++) {
18918        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
18919      }
18920    }
18921    ;
18922  }
18923
18924  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(
18925      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18926    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
18927    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json,
18928        owner, res);
18929    return res;
18930  }
18931
18932  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(
18933      JsonObject json, MedicationKnowledge owner,
18934      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res)
18935      throws IOException, FHIRFormatError {
18936    parseBackboneElementProperties(json, res);
18937    Type characteristic = parseType("characteristic", json);
18938    if (characteristic != null)
18939      res.setCharacteristic(characteristic);
18940    if (json.has("value")) {
18941      JsonArray array = json.getAsJsonArray("value");
18942      for (int i = 0; i < array.size(); i++) {
18943        if (array.get(i).isJsonNull()) {
18944          res.getValue().add(new StringType());
18945        } else {
18946          res.getValue().add(parseString(array.get(i).getAsString()));
18947        }
18948      }
18949    }
18950    ;
18951    if (json.has("_value")) {
18952      JsonArray array = json.getAsJsonArray("_value");
18953      for (int i = 0; i < array.size(); i++) {
18954        if (i == res.getValue().size())
18955          res.getValue().add(parseString(null));
18956        if (array.get(i) instanceof JsonObject)
18957          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
18958      }
18959    }
18960    ;
18961  }
18962
18963  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(
18964      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18965    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
18966    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
18967    return res;
18968  }
18969
18970  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json,
18971      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res)
18972      throws IOException, FHIRFormatError {
18973    parseBackboneElementProperties(json, res);
18974    if (json.has("type"))
18975      res.setType(parseCodeableConcept(getJObject(json, "type")));
18976    if (json.has("classification")) {
18977      JsonArray array = json.getAsJsonArray("classification");
18978      for (int i = 0; i < array.size(); i++) {
18979        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18980      }
18981    }
18982    ;
18983  }
18984
18985  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(
18986      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
18987    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
18988    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
18989    return res;
18990  }
18991
18992  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json,
18993      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res)
18994      throws IOException, FHIRFormatError {
18995    parseBackboneElementProperties(json, res);
18996    if (json.has("type"))
18997      res.setType(parseCodeableConcept(getJObject(json, "type")));
18998    if (json.has("quantity"))
18999      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19000  }
19001
19002  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(
19003      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
19004    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
19005    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
19006    return res;
19007  }
19008
19009  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json,
19010      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res)
19011      throws IOException, FHIRFormatError {
19012    parseBackboneElementProperties(json, res);
19013    if (json.has("type"))
19014      res.setType(parseCodeableConcept(getJObject(json, "type")));
19015    Type value = parseType("value", json);
19016    if (value != null)
19017      res.setValue(value);
19018  }
19019
19020  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(
19021      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
19022    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
19023    parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(json, owner, res);
19024    return res;
19025  }
19026
19027  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(JsonObject json,
19028      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res)
19029      throws IOException, FHIRFormatError {
19030    parseBackboneElementProperties(json, res);
19031    if (json.has("regulatoryAuthority"))
19032      res.setRegulatoryAuthority(parseReference(getJObject(json, "regulatoryAuthority")));
19033    if (json.has("substitution")) {
19034      JsonArray array = json.getAsJsonArray("substitution");
19035      for (int i = 0; i < array.size(); i++) {
19036        res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(
19037            array.get(i).getAsJsonObject(), owner));
19038      }
19039    }
19040    ;
19041    if (json.has("schedule")) {
19042      JsonArray array = json.getAsJsonArray("schedule");
19043      for (int i = 0; i < array.size(); i++) {
19044        res.getSchedule().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(
19045            array.get(i).getAsJsonObject(), owner));
19046      }
19047    }
19048    ;
19049    if (json.has("maxDispense"))
19050      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(
19051          getJObject(json, "maxDispense"), owner));
19052  }
19053
19054  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(
19055      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
19056    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
19057    parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, owner, res);
19058    return res;
19059  }
19060
19061  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json,
19062      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res)
19063      throws IOException, FHIRFormatError {
19064    parseBackboneElementProperties(json, res);
19065    if (json.has("type"))
19066      res.setType(parseCodeableConcept(getJObject(json, "type")));
19067    if (json.has("allowed"))
19068      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
19069    if (json.has("_allowed"))
19070      parseElementProperties(getJObject(json, "_allowed"), res.getAllowedElement());
19071  }
19072
19073  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(
19074      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
19075    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
19076    parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(json, owner, res);
19077    return res;
19078  }
19079
19080  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(JsonObject json,
19081      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res)
19082      throws IOException, FHIRFormatError {
19083    parseBackboneElementProperties(json, res);
19084    if (json.has("schedule"))
19085      res.setSchedule(parseCodeableConcept(getJObject(json, "schedule")));
19086  }
19087
19088  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(
19089      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
19090    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
19091    parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, owner, res);
19092    return res;
19093  }
19094
19095  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json,
19096      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res)
19097      throws IOException, FHIRFormatError {
19098    parseBackboneElementProperties(json, res);
19099    if (json.has("quantity"))
19100      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19101    if (json.has("period"))
19102      res.setPeriod(parseDuration(getJObject(json, "period")));
19103  }
19104
19105  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(
19106      JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
19107    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
19108    parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(json, owner, res);
19109    return res;
19110  }
19111
19112  protected void parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(JsonObject json,
19113      MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticsComponent res)
19114      throws IOException, FHIRFormatError {
19115    parseBackboneElementProperties(json, res);
19116    if (json.has("areaUnderCurve")) {
19117      JsonArray array = json.getAsJsonArray("areaUnderCurve");
19118      for (int i = 0; i < array.size(); i++) {
19119        res.getAreaUnderCurve().add(parseQuantity(array.get(i).getAsJsonObject()));
19120      }
19121    }
19122    ;
19123    if (json.has("lethalDose50")) {
19124      JsonArray array = json.getAsJsonArray("lethalDose50");
19125      for (int i = 0; i < array.size(); i++) {
19126        res.getLethalDose50().add(parseQuantity(array.get(i).getAsJsonObject()));
19127      }
19128    }
19129    ;
19130    if (json.has("halfLifePeriod"))
19131      res.setHalfLifePeriod(parseDuration(getJObject(json, "halfLifePeriod")));
19132  }
19133
19134  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
19135    MedicationRequest res = new MedicationRequest();
19136    parseMedicationRequestProperties(json, res);
19137    return res;
19138  }
19139
19140  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res)
19141      throws IOException, FHIRFormatError {
19142    parseDomainResourceProperties(json, res);
19143    if (json.has("identifier")) {
19144      JsonArray array = json.getAsJsonArray("identifier");
19145      for (int i = 0; i < array.size(); i++) {
19146        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19147      }
19148    }
19149    ;
19150    if (json.has("status"))
19151      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
19152          MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
19153    if (json.has("_status"))
19154      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19155    if (json.has("statusReason"))
19156      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
19157    if (json.has("intent"))
19158      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(),
19159          MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
19160    if (json.has("_intent"))
19161      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
19162    if (json.has("category")) {
19163      JsonArray array = json.getAsJsonArray("category");
19164      for (int i = 0; i < array.size(); i++) {
19165        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19166      }
19167    }
19168    ;
19169    if (json.has("priority"))
19170      res.setPriorityElement(
19171          parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL,
19172              new MedicationRequest.MedicationRequestPriorityEnumFactory()));
19173    if (json.has("_priority"))
19174      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
19175    if (json.has("doNotPerform"))
19176      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
19177    if (json.has("_doNotPerform"))
19178      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
19179    Type reported = parseType("reported", json);
19180    if (reported != null)
19181      res.setReported(reported);
19182    Type medication = parseType("medication", json);
19183    if (medication != null)
19184      res.setMedication(medication);
19185    if (json.has("subject"))
19186      res.setSubject(parseReference(getJObject(json, "subject")));
19187    if (json.has("encounter"))
19188      res.setEncounter(parseReference(getJObject(json, "encounter")));
19189    if (json.has("supportingInformation")) {
19190      JsonArray array = json.getAsJsonArray("supportingInformation");
19191      for (int i = 0; i < array.size(); i++) {
19192        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
19193      }
19194    }
19195    ;
19196    if (json.has("authoredOn"))
19197      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
19198    if (json.has("_authoredOn"))
19199      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
19200    if (json.has("requester"))
19201      res.setRequester(parseReference(getJObject(json, "requester")));
19202    if (json.has("performer"))
19203      res.setPerformer(parseReference(getJObject(json, "performer")));
19204    if (json.has("performerType"))
19205      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
19206    if (json.has("recorder"))
19207      res.setRecorder(parseReference(getJObject(json, "recorder")));
19208    if (json.has("reasonCode")) {
19209      JsonArray array = json.getAsJsonArray("reasonCode");
19210      for (int i = 0; i < array.size(); i++) {
19211        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19212      }
19213    }
19214    ;
19215    if (json.has("reasonReference")) {
19216      JsonArray array = json.getAsJsonArray("reasonReference");
19217      for (int i = 0; i < array.size(); i++) {
19218        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
19219      }
19220    }
19221    ;
19222    if (json.has("instantiatesCanonical")) {
19223      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
19224      for (int i = 0; i < array.size(); i++) {
19225        if (array.get(i).isJsonNull()) {
19226          res.getInstantiatesCanonical().add(new CanonicalType());
19227        } else {
19228          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
19229        }
19230      }
19231    }
19232    ;
19233    if (json.has("_instantiatesCanonical")) {
19234      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
19235      for (int i = 0; i < array.size(); i++) {
19236        if (i == res.getInstantiatesCanonical().size())
19237          res.getInstantiatesCanonical().add(parseCanonical(null));
19238        if (array.get(i) instanceof JsonObject)
19239          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
19240      }
19241    }
19242    ;
19243    if (json.has("instantiatesUri")) {
19244      JsonArray array = json.getAsJsonArray("instantiatesUri");
19245      for (int i = 0; i < array.size(); i++) {
19246        if (array.get(i).isJsonNull()) {
19247          res.getInstantiatesUri().add(new UriType());
19248        } else {
19249          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
19250        }
19251      }
19252    }
19253    ;
19254    if (json.has("_instantiatesUri")) {
19255      JsonArray array = json.getAsJsonArray("_instantiatesUri");
19256      for (int i = 0; i < array.size(); i++) {
19257        if (i == res.getInstantiatesUri().size())
19258          res.getInstantiatesUri().add(parseUri(null));
19259        if (array.get(i) instanceof JsonObject)
19260          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
19261      }
19262    }
19263    ;
19264    if (json.has("basedOn")) {
19265      JsonArray array = json.getAsJsonArray("basedOn");
19266      for (int i = 0; i < array.size(); i++) {
19267        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
19268      }
19269    }
19270    ;
19271    if (json.has("groupIdentifier"))
19272      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
19273    if (json.has("courseOfTherapyType"))
19274      res.setCourseOfTherapyType(parseCodeableConcept(getJObject(json, "courseOfTherapyType")));
19275    if (json.has("insurance")) {
19276      JsonArray array = json.getAsJsonArray("insurance");
19277      for (int i = 0; i < array.size(); i++) {
19278        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
19279      }
19280    }
19281    ;
19282    if (json.has("note")) {
19283      JsonArray array = json.getAsJsonArray("note");
19284      for (int i = 0; i < array.size(); i++) {
19285        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19286      }
19287    }
19288    ;
19289    if (json.has("dosageInstruction")) {
19290      JsonArray array = json.getAsJsonArray("dosageInstruction");
19291      for (int i = 0; i < array.size(); i++) {
19292        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
19293      }
19294    }
19295    ;
19296    if (json.has("dispenseRequest"))
19297      res.setDispenseRequest(
19298          parseMedicationRequestMedicationRequestDispenseRequestComponent(getJObject(json, "dispenseRequest"), res));
19299    if (json.has("substitution"))
19300      res.setSubstitution(
19301          parseMedicationRequestMedicationRequestSubstitutionComponent(getJObject(json, "substitution"), res));
19302    if (json.has("priorPrescription"))
19303      res.setPriorPrescription(parseReference(getJObject(json, "priorPrescription")));
19304    if (json.has("detectedIssue")) {
19305      JsonArray array = json.getAsJsonArray("detectedIssue");
19306      for (int i = 0; i < array.size(); i++) {
19307        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
19308      }
19309    }
19310    ;
19311    if (json.has("eventHistory")) {
19312      JsonArray array = json.getAsJsonArray("eventHistory");
19313      for (int i = 0; i < array.size(); i++) {
19314        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
19315      }
19316    }
19317    ;
19318  }
19319
19320  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(
19321      JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
19322    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
19323    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
19324    return res;
19325  }
19326
19327  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json,
19328      MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res)
19329      throws IOException, FHIRFormatError {
19330    parseBackboneElementProperties(json, res);
19331    if (json.has("initialFill"))
19332      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(
19333          getJObject(json, "initialFill"), owner));
19334    if (json.has("dispenseInterval"))
19335      res.setDispenseInterval(parseDuration(getJObject(json, "dispenseInterval")));
19336    if (json.has("validityPeriod"))
19337      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
19338    if (json.has("numberOfRepeatsAllowed"))
19339      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
19340    if (json.has("_numberOfRepeatsAllowed"))
19341      parseElementProperties(getJObject(json, "_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
19342    if (json.has("quantity"))
19343      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19344    if (json.has("expectedSupplyDuration"))
19345      res.setExpectedSupplyDuration(parseDuration(getJObject(json, "expectedSupplyDuration")));
19346    if (json.has("performer"))
19347      res.setPerformer(parseReference(getJObject(json, "performer")));
19348  }
19349
19350  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(
19351      JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
19352    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
19353    parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(json, owner, res);
19354    return res;
19355  }
19356
19357  protected void parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json,
19358      MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res)
19359      throws IOException, FHIRFormatError {
19360    parseBackboneElementProperties(json, res);
19361    if (json.has("quantity"))
19362      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19363    if (json.has("duration"))
19364      res.setDuration(parseDuration(getJObject(json, "duration")));
19365  }
19366
19367  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(
19368      JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
19369    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
19370    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
19371    return res;
19372  }
19373
19374  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json,
19375      MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res)
19376      throws IOException, FHIRFormatError {
19377    parseBackboneElementProperties(json, res);
19378    Type allowed = parseType("allowed", json);
19379    if (allowed != null)
19380      res.setAllowed(allowed);
19381    if (json.has("reason"))
19382      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
19383  }
19384
19385  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
19386    MedicationStatement res = new MedicationStatement();
19387    parseMedicationStatementProperties(json, res);
19388    return res;
19389  }
19390
19391  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res)
19392      throws IOException, FHIRFormatError {
19393    parseDomainResourceProperties(json, res);
19394    if (json.has("identifier")) {
19395      JsonArray array = json.getAsJsonArray("identifier");
19396      for (int i = 0; i < array.size(); i++) {
19397        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19398      }
19399    }
19400    ;
19401    if (json.has("basedOn")) {
19402      JsonArray array = json.getAsJsonArray("basedOn");
19403      for (int i = 0; i < array.size(); i++) {
19404        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
19405      }
19406    }
19407    ;
19408    if (json.has("partOf")) {
19409      JsonArray array = json.getAsJsonArray("partOf");
19410      for (int i = 0; i < array.size(); i++) {
19411        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
19412      }
19413    }
19414    ;
19415    if (json.has("status"))
19416      res.setStatusElement(
19417          parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL,
19418              new MedicationStatement.MedicationStatementStatusEnumFactory()));
19419    if (json.has("_status"))
19420      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19421    if (json.has("statusReason")) {
19422      JsonArray array = json.getAsJsonArray("statusReason");
19423      for (int i = 0; i < array.size(); i++) {
19424        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19425      }
19426    }
19427    ;
19428    if (json.has("category"))
19429      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
19430    Type medication = parseType("medication", json);
19431    if (medication != null)
19432      res.setMedication(medication);
19433    if (json.has("subject"))
19434      res.setSubject(parseReference(getJObject(json, "subject")));
19435    if (json.has("context"))
19436      res.setContext(parseReference(getJObject(json, "context")));
19437    Type effective = parseType("effective", json);
19438    if (effective != null)
19439      res.setEffective(effective);
19440    if (json.has("dateAsserted"))
19441      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
19442    if (json.has("_dateAsserted"))
19443      parseElementProperties(getJObject(json, "_dateAsserted"), res.getDateAssertedElement());
19444    if (json.has("informationSource"))
19445      res.setInformationSource(parseReference(getJObject(json, "informationSource")));
19446    if (json.has("derivedFrom")) {
19447      JsonArray array = json.getAsJsonArray("derivedFrom");
19448      for (int i = 0; i < array.size(); i++) {
19449        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19450      }
19451    }
19452    ;
19453    if (json.has("reasonCode")) {
19454      JsonArray array = json.getAsJsonArray("reasonCode");
19455      for (int i = 0; i < array.size(); i++) {
19456        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19457      }
19458    }
19459    ;
19460    if (json.has("reasonReference")) {
19461      JsonArray array = json.getAsJsonArray("reasonReference");
19462      for (int i = 0; i < array.size(); i++) {
19463        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
19464      }
19465    }
19466    ;
19467    if (json.has("note")) {
19468      JsonArray array = json.getAsJsonArray("note");
19469      for (int i = 0; i < array.size(); i++) {
19470        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19471      }
19472    }
19473    ;
19474    if (json.has("dosage")) {
19475      JsonArray array = json.getAsJsonArray("dosage");
19476      for (int i = 0; i < array.size(); i++) {
19477        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
19478      }
19479    }
19480    ;
19481  }
19482
19483  protected MedicinalProduct parseMedicinalProduct(JsonObject json) throws IOException, FHIRFormatError {
19484    MedicinalProduct res = new MedicinalProduct();
19485    parseMedicinalProductProperties(json, res);
19486    return res;
19487  }
19488
19489  protected void parseMedicinalProductProperties(JsonObject json, MedicinalProduct res)
19490      throws IOException, FHIRFormatError {
19491    parseDomainResourceProperties(json, res);
19492    if (json.has("identifier")) {
19493      JsonArray array = json.getAsJsonArray("identifier");
19494      for (int i = 0; i < array.size(); i++) {
19495        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19496      }
19497    }
19498    ;
19499    if (json.has("type"))
19500      res.setType(parseCodeableConcept(getJObject(json, "type")));
19501    if (json.has("domain"))
19502      res.setDomain(parseCoding(getJObject(json, "domain")));
19503    if (json.has("combinedPharmaceuticalDoseForm"))
19504      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(getJObject(json, "combinedPharmaceuticalDoseForm")));
19505    if (json.has("legalStatusOfSupply"))
19506      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
19507    if (json.has("additionalMonitoringIndicator"))
19508      res.setAdditionalMonitoringIndicator(parseCodeableConcept(getJObject(json, "additionalMonitoringIndicator")));
19509    if (json.has("specialMeasures")) {
19510      JsonArray array = json.getAsJsonArray("specialMeasures");
19511      for (int i = 0; i < array.size(); i++) {
19512        if (array.get(i).isJsonNull()) {
19513          res.getSpecialMeasures().add(new StringType());
19514        } else {
19515          res.getSpecialMeasures().add(parseString(array.get(i).getAsString()));
19516        }
19517      }
19518    }
19519    ;
19520    if (json.has("_specialMeasures")) {
19521      JsonArray array = json.getAsJsonArray("_specialMeasures");
19522      for (int i = 0; i < array.size(); i++) {
19523        if (i == res.getSpecialMeasures().size())
19524          res.getSpecialMeasures().add(parseString(null));
19525        if (array.get(i) instanceof JsonObject)
19526          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasures().get(i));
19527      }
19528    }
19529    ;
19530    if (json.has("paediatricUseIndicator"))
19531      res.setPaediatricUseIndicator(parseCodeableConcept(getJObject(json, "paediatricUseIndicator")));
19532    if (json.has("productClassification")) {
19533      JsonArray array = json.getAsJsonArray("productClassification");
19534      for (int i = 0; i < array.size(); i++) {
19535        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19536      }
19537    }
19538    ;
19539    if (json.has("marketingStatus")) {
19540      JsonArray array = json.getAsJsonArray("marketingStatus");
19541      for (int i = 0; i < array.size(); i++) {
19542        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
19543      }
19544    }
19545    ;
19546    if (json.has("pharmaceuticalProduct")) {
19547      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
19548      for (int i = 0; i < array.size(); i++) {
19549        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
19550      }
19551    }
19552    ;
19553    if (json.has("packagedMedicinalProduct")) {
19554      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
19555      for (int i = 0; i < array.size(); i++) {
19556        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
19557      }
19558    }
19559    ;
19560    if (json.has("attachedDocument")) {
19561      JsonArray array = json.getAsJsonArray("attachedDocument");
19562      for (int i = 0; i < array.size(); i++) {
19563        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
19564      }
19565    }
19566    ;
19567    if (json.has("masterFile")) {
19568      JsonArray array = json.getAsJsonArray("masterFile");
19569      for (int i = 0; i < array.size(); i++) {
19570        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
19571      }
19572    }
19573    ;
19574    if (json.has("contact")) {
19575      JsonArray array = json.getAsJsonArray("contact");
19576      for (int i = 0; i < array.size(); i++) {
19577        res.getContact().add(parseReference(array.get(i).getAsJsonObject()));
19578      }
19579    }
19580    ;
19581    if (json.has("clinicalTrial")) {
19582      JsonArray array = json.getAsJsonArray("clinicalTrial");
19583      for (int i = 0; i < array.size(); i++) {
19584        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
19585      }
19586    }
19587    ;
19588    if (json.has("name")) {
19589      JsonArray array = json.getAsJsonArray("name");
19590      for (int i = 0; i < array.size(); i++) {
19591        res.getName().add(parseMedicinalProductMedicinalProductNameComponent(array.get(i).getAsJsonObject(), res));
19592      }
19593    }
19594    ;
19595    if (json.has("crossReference")) {
19596      JsonArray array = json.getAsJsonArray("crossReference");
19597      for (int i = 0; i < array.size(); i++) {
19598        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
19599      }
19600    }
19601    ;
19602    if (json.has("manufacturingBusinessOperation")) {
19603      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
19604      for (int i = 0; i < array.size(); i++) {
19605        res.getManufacturingBusinessOperation().add(
19606            parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(),
19607                res));
19608      }
19609    }
19610    ;
19611    if (json.has("specialDesignation")) {
19612      JsonArray array = json.getAsJsonArray("specialDesignation");
19613      for (int i = 0; i < array.size(); i++) {
19614        res.getSpecialDesignation()
19615            .add(parseMedicinalProductMedicinalProductSpecialDesignationComponent(array.get(i).getAsJsonObject(), res));
19616      }
19617    }
19618    ;
19619  }
19620
19621  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(
19622      JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
19623    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
19624    parseMedicinalProductMedicinalProductNameComponentProperties(json, owner, res);
19625    return res;
19626  }
19627
19628  protected void parseMedicinalProductMedicinalProductNameComponentProperties(JsonObject json, MedicinalProduct owner,
19629      MedicinalProduct.MedicinalProductNameComponent res) throws IOException, FHIRFormatError {
19630    parseBackboneElementProperties(json, res);
19631    if (json.has("productName"))
19632      res.setProductNameElement(parseString(json.get("productName").getAsString()));
19633    if (json.has("_productName"))
19634      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
19635    if (json.has("namePart")) {
19636      JsonArray array = json.getAsJsonArray("namePart");
19637      for (int i = 0; i < array.size(); i++) {
19638        res.getNamePart()
19639            .add(parseMedicinalProductMedicinalProductNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
19640      }
19641    }
19642    ;
19643    if (json.has("countryLanguage")) {
19644      JsonArray array = json.getAsJsonArray("countryLanguage");
19645      for (int i = 0; i < array.size(); i++) {
19646        res.getCountryLanguage().add(
19647            parseMedicinalProductMedicinalProductNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
19648      }
19649    }
19650    ;
19651  }
19652
19653  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(
19654      JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
19655    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
19656    parseMedicinalProductMedicinalProductNameNamePartComponentProperties(json, owner, res);
19657    return res;
19658  }
19659
19660  protected void parseMedicinalProductMedicinalProductNameNamePartComponentProperties(JsonObject json,
19661      MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res)
19662      throws IOException, FHIRFormatError {
19663    parseBackboneElementProperties(json, res);
19664    if (json.has("part"))
19665      res.setPartElement(parseString(json.get("part").getAsString()));
19666    if (json.has("_part"))
19667      parseElementProperties(getJObject(json, "_part"), res.getPartElement());
19668    if (json.has("type"))
19669      res.setType(parseCoding(getJObject(json, "type")));
19670  }
19671
19672  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(
19673      JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
19674    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
19675    parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(json, owner, res);
19676    return res;
19677  }
19678
19679  protected void parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(JsonObject json,
19680      MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res)
19681      throws IOException, FHIRFormatError {
19682    parseBackboneElementProperties(json, res);
19683    if (json.has("country"))
19684      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
19685    if (json.has("jurisdiction"))
19686      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
19687    if (json.has("language"))
19688      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
19689  }
19690
19691  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(
19692      JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
19693    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
19694    parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(json, owner, res);
19695    return res;
19696  }
19697
19698  protected void parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(JsonObject json,
19699      MedicinalProduct owner, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res)
19700      throws IOException, FHIRFormatError {
19701    parseBackboneElementProperties(json, res);
19702    if (json.has("operationType"))
19703      res.setOperationType(parseCodeableConcept(getJObject(json, "operationType")));
19704    if (json.has("authorisationReferenceNumber"))
19705      res.setAuthorisationReferenceNumber(parseIdentifier(getJObject(json, "authorisationReferenceNumber")));
19706    if (json.has("effectiveDate"))
19707      res.setEffectiveDateElement(parseDateTime(json.get("effectiveDate").getAsString()));
19708    if (json.has("_effectiveDate"))
19709      parseElementProperties(getJObject(json, "_effectiveDate"), res.getEffectiveDateElement());
19710    if (json.has("confidentialityIndicator"))
19711      res.setConfidentialityIndicator(parseCodeableConcept(getJObject(json, "confidentialityIndicator")));
19712    if (json.has("manufacturer")) {
19713      JsonArray array = json.getAsJsonArray("manufacturer");
19714      for (int i = 0; i < array.size(); i++) {
19715        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
19716      }
19717    }
19718    ;
19719    if (json.has("regulator"))
19720      res.setRegulator(parseReference(getJObject(json, "regulator")));
19721  }
19722
19723  protected MedicinalProduct.MedicinalProductSpecialDesignationComponent parseMedicinalProductMedicinalProductSpecialDesignationComponent(
19724      JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
19725    MedicinalProduct.MedicinalProductSpecialDesignationComponent res = new MedicinalProduct.MedicinalProductSpecialDesignationComponent();
19726    parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(json, owner, res);
19727    return res;
19728  }
19729
19730  protected void parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(JsonObject json,
19731      MedicinalProduct owner, MedicinalProduct.MedicinalProductSpecialDesignationComponent res)
19732      throws IOException, FHIRFormatError {
19733    parseBackboneElementProperties(json, res);
19734    if (json.has("identifier")) {
19735      JsonArray array = json.getAsJsonArray("identifier");
19736      for (int i = 0; i < array.size(); i++) {
19737        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19738      }
19739    }
19740    ;
19741    if (json.has("type"))
19742      res.setType(parseCodeableConcept(getJObject(json, "type")));
19743    if (json.has("intendedUse"))
19744      res.setIntendedUse(parseCodeableConcept(getJObject(json, "intendedUse")));
19745    Type indication = parseType("indication", json);
19746    if (indication != null)
19747      res.setIndication(indication);
19748    if (json.has("status"))
19749      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
19750    if (json.has("date"))
19751      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19752    if (json.has("_date"))
19753      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19754    if (json.has("species"))
19755      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
19756  }
19757
19758  protected MedicinalProductAuthorization parseMedicinalProductAuthorization(JsonObject json)
19759      throws IOException, FHIRFormatError {
19760    MedicinalProductAuthorization res = new MedicinalProductAuthorization();
19761    parseMedicinalProductAuthorizationProperties(json, res);
19762    return res;
19763  }
19764
19765  protected void parseMedicinalProductAuthorizationProperties(JsonObject json, MedicinalProductAuthorization res)
19766      throws IOException, FHIRFormatError {
19767    parseDomainResourceProperties(json, res);
19768    if (json.has("identifier")) {
19769      JsonArray array = json.getAsJsonArray("identifier");
19770      for (int i = 0; i < array.size(); i++) {
19771        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19772      }
19773    }
19774    ;
19775    if (json.has("subject"))
19776      res.setSubject(parseReference(getJObject(json, "subject")));
19777    if (json.has("country")) {
19778      JsonArray array = json.getAsJsonArray("country");
19779      for (int i = 0; i < array.size(); i++) {
19780        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19781      }
19782    }
19783    ;
19784    if (json.has("jurisdiction")) {
19785      JsonArray array = json.getAsJsonArray("jurisdiction");
19786      for (int i = 0; i < array.size(); i++) {
19787        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19788      }
19789    }
19790    ;
19791    if (json.has("status"))
19792      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
19793    if (json.has("statusDate"))
19794      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
19795    if (json.has("_statusDate"))
19796      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
19797    if (json.has("restoreDate"))
19798      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
19799    if (json.has("_restoreDate"))
19800      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
19801    if (json.has("validityPeriod"))
19802      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
19803    if (json.has("dataExclusivityPeriod"))
19804      res.setDataExclusivityPeriod(parsePeriod(getJObject(json, "dataExclusivityPeriod")));
19805    if (json.has("dateOfFirstAuthorization"))
19806      res.setDateOfFirstAuthorizationElement(parseDateTime(json.get("dateOfFirstAuthorization").getAsString()));
19807    if (json.has("_dateOfFirstAuthorization"))
19808      parseElementProperties(getJObject(json, "_dateOfFirstAuthorization"), res.getDateOfFirstAuthorizationElement());
19809    if (json.has("internationalBirthDate"))
19810      res.setInternationalBirthDateElement(parseDateTime(json.get("internationalBirthDate").getAsString()));
19811    if (json.has("_internationalBirthDate"))
19812      parseElementProperties(getJObject(json, "_internationalBirthDate"), res.getInternationalBirthDateElement());
19813    if (json.has("legalBasis"))
19814      res.setLegalBasis(parseCodeableConcept(getJObject(json, "legalBasis")));
19815    if (json.has("jurisdictionalAuthorization")) {
19816      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
19817      for (int i = 0; i < array.size(); i++) {
19818        res.getJurisdictionalAuthorization()
19819            .add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(
19820                array.get(i).getAsJsonObject(), res));
19821      }
19822    }
19823    ;
19824    if (json.has("holder"))
19825      res.setHolder(parseReference(getJObject(json, "holder")));
19826    if (json.has("regulator"))
19827      res.setRegulator(parseReference(getJObject(json, "regulator")));
19828    if (json.has("procedure"))
19829      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(
19830          getJObject(json, "procedure"), res));
19831  }
19832
19833  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(
19834      JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
19835    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
19836    parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(json,
19837        owner, res);
19838    return res;
19839  }
19840
19841  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(
19842      JsonObject json, MedicinalProductAuthorization owner,
19843      MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res)
19844      throws IOException, FHIRFormatError {
19845    parseBackboneElementProperties(json, res);
19846    if (json.has("identifier")) {
19847      JsonArray array = json.getAsJsonArray("identifier");
19848      for (int i = 0; i < array.size(); i++) {
19849        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19850      }
19851    }
19852    ;
19853    if (json.has("country"))
19854      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
19855    if (json.has("jurisdiction")) {
19856      JsonArray array = json.getAsJsonArray("jurisdiction");
19857      for (int i = 0; i < array.size(); i++) {
19858        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19859      }
19860    }
19861    ;
19862    if (json.has("legalStatusOfSupply"))
19863      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
19864    if (json.has("validityPeriod"))
19865      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
19866  }
19867
19868  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(
19869      JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
19870    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
19871    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(json, owner, res);
19872    return res;
19873  }
19874
19875  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(
19876      JsonObject json, MedicinalProductAuthorization owner,
19877      MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res)
19878      throws IOException, FHIRFormatError {
19879    parseBackboneElementProperties(json, res);
19880    if (json.has("identifier"))
19881      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
19882    if (json.has("type"))
19883      res.setType(parseCodeableConcept(getJObject(json, "type")));
19884    Type date = parseType("date", json);
19885    if (date != null)
19886      res.setDate(date);
19887    if (json.has("application")) {
19888      JsonArray array = json.getAsJsonArray("application");
19889      for (int i = 0; i < array.size(); i++) {
19890        res.getApplication().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(
19891            array.get(i).getAsJsonObject(), owner));
19892      }
19893    }
19894    ;
19895  }
19896
19897  protected MedicinalProductContraindication parseMedicinalProductContraindication(JsonObject json)
19898      throws IOException, FHIRFormatError {
19899    MedicinalProductContraindication res = new MedicinalProductContraindication();
19900    parseMedicinalProductContraindicationProperties(json, res);
19901    return res;
19902  }
19903
19904  protected void parseMedicinalProductContraindicationProperties(JsonObject json, MedicinalProductContraindication res)
19905      throws IOException, FHIRFormatError {
19906    parseDomainResourceProperties(json, res);
19907    if (json.has("subject")) {
19908      JsonArray array = json.getAsJsonArray("subject");
19909      for (int i = 0; i < array.size(); i++) {
19910        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
19911      }
19912    }
19913    ;
19914    if (json.has("disease"))
19915      res.setDisease(parseCodeableConcept(getJObject(json, "disease")));
19916    if (json.has("diseaseStatus"))
19917      res.setDiseaseStatus(parseCodeableConcept(getJObject(json, "diseaseStatus")));
19918    if (json.has("comorbidity")) {
19919      JsonArray array = json.getAsJsonArray("comorbidity");
19920      for (int i = 0; i < array.size(); i++) {
19921        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19922      }
19923    }
19924    ;
19925    if (json.has("therapeuticIndication")) {
19926      JsonArray array = json.getAsJsonArray("therapeuticIndication");
19927      for (int i = 0; i < array.size(); i++) {
19928        res.getTherapeuticIndication().add(parseReference(array.get(i).getAsJsonObject()));
19929      }
19930    }
19931    ;
19932    if (json.has("otherTherapy")) {
19933      JsonArray array = json.getAsJsonArray("otherTherapy");
19934      for (int i = 0; i < array.size(); i++) {
19935        res.getOtherTherapy()
19936            .add(parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(
19937                array.get(i).getAsJsonObject(), res));
19938      }
19939    }
19940    ;
19941    if (json.has("population")) {
19942      JsonArray array = json.getAsJsonArray("population");
19943      for (int i = 0; i < array.size(); i++) {
19944        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
19945      }
19946    }
19947    ;
19948  }
19949
19950  protected MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(
19951      JsonObject json, MedicinalProductContraindication owner) throws IOException, FHIRFormatError {
19952    MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent();
19953    parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(json, owner,
19954        res);
19955    return res;
19956  }
19957
19958  protected void parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(
19959      JsonObject json, MedicinalProductContraindication owner,
19960      MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res)
19961      throws IOException, FHIRFormatError {
19962    parseBackboneElementProperties(json, res);
19963    if (json.has("therapyRelationshipType"))
19964      res.setTherapyRelationshipType(parseCodeableConcept(getJObject(json, "therapyRelationshipType")));
19965    Type medication = parseType("medication", json);
19966    if (medication != null)
19967      res.setMedication(medication);
19968  }
19969
19970  protected MedicinalProductIndication parseMedicinalProductIndication(JsonObject json)
19971      throws IOException, FHIRFormatError {
19972    MedicinalProductIndication res = new MedicinalProductIndication();
19973    parseMedicinalProductIndicationProperties(json, res);
19974    return res;
19975  }
19976
19977  protected void parseMedicinalProductIndicationProperties(JsonObject json, MedicinalProductIndication res)
19978      throws IOException, FHIRFormatError {
19979    parseDomainResourceProperties(json, res);
19980    if (json.has("subject")) {
19981      JsonArray array = json.getAsJsonArray("subject");
19982      for (int i = 0; i < array.size(); i++) {
19983        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
19984      }
19985    }
19986    ;
19987    if (json.has("diseaseSymptomProcedure"))
19988      res.setDiseaseSymptomProcedure(parseCodeableConcept(getJObject(json, "diseaseSymptomProcedure")));
19989    if (json.has("diseaseStatus"))
19990      res.setDiseaseStatus(parseCodeableConcept(getJObject(json, "diseaseStatus")));
19991    if (json.has("comorbidity")) {
19992      JsonArray array = json.getAsJsonArray("comorbidity");
19993      for (int i = 0; i < array.size(); i++) {
19994        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19995      }
19996    }
19997    ;
19998    if (json.has("intendedEffect"))
19999      res.setIntendedEffect(parseCodeableConcept(getJObject(json, "intendedEffect")));
20000    if (json.has("duration"))
20001      res.setDuration(parseQuantity(getJObject(json, "duration")));
20002    if (json.has("otherTherapy")) {
20003      JsonArray array = json.getAsJsonArray("otherTherapy");
20004      for (int i = 0; i < array.size(); i++) {
20005        res.getOtherTherapy().add(parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(
20006            array.get(i).getAsJsonObject(), res));
20007      }
20008    }
20009    ;
20010    if (json.has("undesirableEffect")) {
20011      JsonArray array = json.getAsJsonArray("undesirableEffect");
20012      for (int i = 0; i < array.size(); i++) {
20013        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
20014      }
20015    }
20016    ;
20017    if (json.has("population")) {
20018      JsonArray array = json.getAsJsonArray("population");
20019      for (int i = 0; i < array.size(); i++) {
20020        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
20021      }
20022    }
20023    ;
20024  }
20025
20026  protected MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(
20027      JsonObject json, MedicinalProductIndication owner) throws IOException, FHIRFormatError {
20028    MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res = new MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent();
20029    parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(json, owner, res);
20030    return res;
20031  }
20032
20033  protected void parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(
20034      JsonObject json, MedicinalProductIndication owner,
20035      MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res)
20036      throws IOException, FHIRFormatError {
20037    parseBackboneElementProperties(json, res);
20038    if (json.has("therapyRelationshipType"))
20039      res.setTherapyRelationshipType(parseCodeableConcept(getJObject(json, "therapyRelationshipType")));
20040    Type medication = parseType("medication", json);
20041    if (medication != null)
20042      res.setMedication(medication);
20043  }
20044
20045  protected MedicinalProductIngredient parseMedicinalProductIngredient(JsonObject json)
20046      throws IOException, FHIRFormatError {
20047    MedicinalProductIngredient res = new MedicinalProductIngredient();
20048    parseMedicinalProductIngredientProperties(json, res);
20049    return res;
20050  }
20051
20052  protected void parseMedicinalProductIngredientProperties(JsonObject json, MedicinalProductIngredient res)
20053      throws IOException, FHIRFormatError {
20054    parseDomainResourceProperties(json, res);
20055    if (json.has("identifier"))
20056      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
20057    if (json.has("role"))
20058      res.setRole(parseCodeableConcept(getJObject(json, "role")));
20059    if (json.has("allergenicIndicator"))
20060      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
20061    if (json.has("_allergenicIndicator"))
20062      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
20063    if (json.has("manufacturer")) {
20064      JsonArray array = json.getAsJsonArray("manufacturer");
20065      for (int i = 0; i < array.size(); i++) {
20066        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20067      }
20068    }
20069    ;
20070    if (json.has("specifiedSubstance")) {
20071      JsonArray array = json.getAsJsonArray("specifiedSubstance");
20072      for (int i = 0; i < array.size(); i++) {
20073        res.getSpecifiedSubstance()
20074            .add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(
20075                array.get(i).getAsJsonObject(), res));
20076      }
20077    }
20078    ;
20079    if (json.has("substance"))
20080      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(
20081          getJObject(json, "substance"), res));
20082  }
20083
20084  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(
20085      JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
20086    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
20087    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
20088    return res;
20089  }
20090
20091  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(
20092      JsonObject json, MedicinalProductIngredient owner,
20093      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res)
20094      throws IOException, FHIRFormatError {
20095    parseBackboneElementProperties(json, res);
20096    if (json.has("code"))
20097      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20098    if (json.has("group"))
20099      res.setGroup(parseCodeableConcept(getJObject(json, "group")));
20100    if (json.has("confidentiality"))
20101      res.setConfidentiality(parseCodeableConcept(getJObject(json, "confidentiality")));
20102    if (json.has("strength")) {
20103      JsonArray array = json.getAsJsonArray("strength");
20104      for (int i = 0; i < array.size(); i++) {
20105        res.getStrength()
20106            .add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(
20107                array.get(i).getAsJsonObject(), owner));
20108      }
20109    }
20110    ;
20111  }
20112
20113  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(
20114      JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
20115    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
20116    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner,
20117        res);
20118    return res;
20119  }
20120
20121  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(
20122      JsonObject json, MedicinalProductIngredient owner,
20123      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res)
20124      throws IOException, FHIRFormatError {
20125    parseBackboneElementProperties(json, res);
20126    if (json.has("presentation"))
20127      res.setPresentation(parseRatio(getJObject(json, "presentation")));
20128    if (json.has("presentationLowLimit"))
20129      res.setPresentationLowLimit(parseRatio(getJObject(json, "presentationLowLimit")));
20130    if (json.has("concentration"))
20131      res.setConcentration(parseRatio(getJObject(json, "concentration")));
20132    if (json.has("concentrationLowLimit"))
20133      res.setConcentrationLowLimit(parseRatio(getJObject(json, "concentrationLowLimit")));
20134    if (json.has("measurementPoint"))
20135      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
20136    if (json.has("_measurementPoint"))
20137      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
20138    if (json.has("country")) {
20139      JsonArray array = json.getAsJsonArray("country");
20140      for (int i = 0; i < array.size(); i++) {
20141        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20142      }
20143    }
20144    ;
20145    if (json.has("referenceStrength")) {
20146      JsonArray array = json.getAsJsonArray("referenceStrength");
20147      for (int i = 0; i < array.size(); i++) {
20148        res.getReferenceStrength().add(
20149            parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
20150                array.get(i).getAsJsonObject(), owner));
20151      }
20152    }
20153    ;
20154  }
20155
20156  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
20157      JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
20158    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
20159    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(
20160        json, owner, res);
20161    return res;
20162  }
20163
20164  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(
20165      JsonObject json, MedicinalProductIngredient owner,
20166      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res)
20167      throws IOException, FHIRFormatError {
20168    parseBackboneElementProperties(json, res);
20169    if (json.has("substance"))
20170      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
20171    if (json.has("strength"))
20172      res.setStrength(parseRatio(getJObject(json, "strength")));
20173    if (json.has("strengthLowLimit"))
20174      res.setStrengthLowLimit(parseRatio(getJObject(json, "strengthLowLimit")));
20175    if (json.has("measurementPoint"))
20176      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
20177    if (json.has("_measurementPoint"))
20178      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
20179    if (json.has("country")) {
20180      JsonArray array = json.getAsJsonArray("country");
20181      for (int i = 0; i < array.size(); i++) {
20182        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20183      }
20184    }
20185    ;
20186  }
20187
20188  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(
20189      JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
20190    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
20191    parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(json, owner, res);
20192    return res;
20193  }
20194
20195  protected void parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(JsonObject json,
20196      MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res)
20197      throws IOException, FHIRFormatError {
20198    parseBackboneElementProperties(json, res);
20199    if (json.has("code"))
20200      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20201    if (json.has("strength")) {
20202      JsonArray array = json.getAsJsonArray("strength");
20203      for (int i = 0; i < array.size(); i++) {
20204        res.getStrength()
20205            .add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(
20206                array.get(i).getAsJsonObject(), owner));
20207      }
20208    }
20209    ;
20210  }
20211
20212  protected MedicinalProductInteraction parseMedicinalProductInteraction(JsonObject json)
20213      throws IOException, FHIRFormatError {
20214    MedicinalProductInteraction res = new MedicinalProductInteraction();
20215    parseMedicinalProductInteractionProperties(json, res);
20216    return res;
20217  }
20218
20219  protected void parseMedicinalProductInteractionProperties(JsonObject json, MedicinalProductInteraction res)
20220      throws IOException, FHIRFormatError {
20221    parseDomainResourceProperties(json, res);
20222    if (json.has("subject")) {
20223      JsonArray array = json.getAsJsonArray("subject");
20224      for (int i = 0; i < array.size(); i++) {
20225        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
20226      }
20227    }
20228    ;
20229    if (json.has("description"))
20230      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20231    if (json.has("_description"))
20232      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20233    if (json.has("interactant")) {
20234      JsonArray array = json.getAsJsonArray("interactant");
20235      for (int i = 0; i < array.size(); i++) {
20236        res.getInteractant().add(parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(
20237            array.get(i).getAsJsonObject(), res));
20238      }
20239    }
20240    ;
20241    if (json.has("type"))
20242      res.setType(parseCodeableConcept(getJObject(json, "type")));
20243    if (json.has("effect"))
20244      res.setEffect(parseCodeableConcept(getJObject(json, "effect")));
20245    if (json.has("incidence"))
20246      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
20247    if (json.has("management"))
20248      res.setManagement(parseCodeableConcept(getJObject(json, "management")));
20249  }
20250
20251  protected MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(
20252      JsonObject json, MedicinalProductInteraction owner) throws IOException, FHIRFormatError {
20253    MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res = new MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent();
20254    parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(json, owner, res);
20255    return res;
20256  }
20257
20258  protected void parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(
20259      JsonObject json, MedicinalProductInteraction owner,
20260      MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res)
20261      throws IOException, FHIRFormatError {
20262    parseBackboneElementProperties(json, res);
20263    Type item = parseType("item", json);
20264    if (item != null)
20265      res.setItem(item);
20266  }
20267
20268  protected MedicinalProductManufactured parseMedicinalProductManufactured(JsonObject json)
20269      throws IOException, FHIRFormatError {
20270    MedicinalProductManufactured res = new MedicinalProductManufactured();
20271    parseMedicinalProductManufacturedProperties(json, res);
20272    return res;
20273  }
20274
20275  protected void parseMedicinalProductManufacturedProperties(JsonObject json, MedicinalProductManufactured res)
20276      throws IOException, FHIRFormatError {
20277    parseDomainResourceProperties(json, res);
20278    if (json.has("manufacturedDoseForm"))
20279      res.setManufacturedDoseForm(parseCodeableConcept(getJObject(json, "manufacturedDoseForm")));
20280    if (json.has("unitOfPresentation"))
20281      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
20282    if (json.has("quantity"))
20283      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
20284    if (json.has("manufacturer")) {
20285      JsonArray array = json.getAsJsonArray("manufacturer");
20286      for (int i = 0; i < array.size(); i++) {
20287        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20288      }
20289    }
20290    ;
20291    if (json.has("ingredient")) {
20292      JsonArray array = json.getAsJsonArray("ingredient");
20293      for (int i = 0; i < array.size(); i++) {
20294        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
20295      }
20296    }
20297    ;
20298    if (json.has("physicalCharacteristics"))
20299      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
20300    if (json.has("otherCharacteristics")) {
20301      JsonArray array = json.getAsJsonArray("otherCharacteristics");
20302      for (int i = 0; i < array.size(); i++) {
20303        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20304      }
20305    }
20306    ;
20307  }
20308
20309  protected MedicinalProductPackaged parseMedicinalProductPackaged(JsonObject json)
20310      throws IOException, FHIRFormatError {
20311    MedicinalProductPackaged res = new MedicinalProductPackaged();
20312    parseMedicinalProductPackagedProperties(json, res);
20313    return res;
20314  }
20315
20316  protected void parseMedicinalProductPackagedProperties(JsonObject json, MedicinalProductPackaged res)
20317      throws IOException, FHIRFormatError {
20318    parseDomainResourceProperties(json, res);
20319    if (json.has("identifier")) {
20320      JsonArray array = json.getAsJsonArray("identifier");
20321      for (int i = 0; i < array.size(); i++) {
20322        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20323      }
20324    }
20325    ;
20326    if (json.has("subject")) {
20327      JsonArray array = json.getAsJsonArray("subject");
20328      for (int i = 0; i < array.size(); i++) {
20329        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
20330      }
20331    }
20332    ;
20333    if (json.has("description"))
20334      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20335    if (json.has("_description"))
20336      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20337    if (json.has("legalStatusOfSupply"))
20338      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
20339    if (json.has("marketingStatus")) {
20340      JsonArray array = json.getAsJsonArray("marketingStatus");
20341      for (int i = 0; i < array.size(); i++) {
20342        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
20343      }
20344    }
20345    ;
20346    if (json.has("marketingAuthorization"))
20347      res.setMarketingAuthorization(parseReference(getJObject(json, "marketingAuthorization")));
20348    if (json.has("manufacturer")) {
20349      JsonArray array = json.getAsJsonArray("manufacturer");
20350      for (int i = 0; i < array.size(); i++) {
20351        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20352      }
20353    }
20354    ;
20355    if (json.has("batchIdentifier")) {
20356      JsonArray array = json.getAsJsonArray("batchIdentifier");
20357      for (int i = 0; i < array.size(); i++) {
20358        res.getBatchIdentifier().add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(
20359            array.get(i).getAsJsonObject(), res));
20360      }
20361    }
20362    ;
20363    if (json.has("packageItem")) {
20364      JsonArray array = json.getAsJsonArray("packageItem");
20365      for (int i = 0; i < array.size(); i++) {
20366        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(
20367            array.get(i).getAsJsonObject(), res));
20368      }
20369    }
20370    ;
20371  }
20372
20373  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(
20374      JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
20375    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
20376    parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(json, owner, res);
20377    return res;
20378  }
20379
20380  protected void parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(
20381      JsonObject json, MedicinalProductPackaged owner,
20382      MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res)
20383      throws IOException, FHIRFormatError {
20384    parseBackboneElementProperties(json, res);
20385    if (json.has("outerPackaging"))
20386      res.setOuterPackaging(parseIdentifier(getJObject(json, "outerPackaging")));
20387    if (json.has("immediatePackaging"))
20388      res.setImmediatePackaging(parseIdentifier(getJObject(json, "immediatePackaging")));
20389  }
20390
20391  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(
20392      JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
20393    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
20394    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(json, owner, res);
20395    return res;
20396  }
20397
20398  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(JsonObject json,
20399      MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res)
20400      throws IOException, FHIRFormatError {
20401    parseBackboneElementProperties(json, res);
20402    if (json.has("identifier")) {
20403      JsonArray array = json.getAsJsonArray("identifier");
20404      for (int i = 0; i < array.size(); i++) {
20405        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20406      }
20407    }
20408    ;
20409    if (json.has("type"))
20410      res.setType(parseCodeableConcept(getJObject(json, "type")));
20411    if (json.has("quantity"))
20412      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
20413    if (json.has("material")) {
20414      JsonArray array = json.getAsJsonArray("material");
20415      for (int i = 0; i < array.size(); i++) {
20416        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20417      }
20418    }
20419    ;
20420    if (json.has("alternateMaterial")) {
20421      JsonArray array = json.getAsJsonArray("alternateMaterial");
20422      for (int i = 0; i < array.size(); i++) {
20423        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20424      }
20425    }
20426    ;
20427    if (json.has("device")) {
20428      JsonArray array = json.getAsJsonArray("device");
20429      for (int i = 0; i < array.size(); i++) {
20430        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
20431      }
20432    }
20433    ;
20434    if (json.has("manufacturedItem")) {
20435      JsonArray array = json.getAsJsonArray("manufacturedItem");
20436      for (int i = 0; i < array.size(); i++) {
20437        res.getManufacturedItem().add(parseReference(array.get(i).getAsJsonObject()));
20438      }
20439    }
20440    ;
20441    if (json.has("packageItem")) {
20442      JsonArray array = json.getAsJsonArray("packageItem");
20443      for (int i = 0; i < array.size(); i++) {
20444        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(
20445            array.get(i).getAsJsonObject(), owner));
20446      }
20447    }
20448    ;
20449    if (json.has("physicalCharacteristics"))
20450      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
20451    if (json.has("otherCharacteristics")) {
20452      JsonArray array = json.getAsJsonArray("otherCharacteristics");
20453      for (int i = 0; i < array.size(); i++) {
20454        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20455      }
20456    }
20457    ;
20458    if (json.has("shelfLifeStorage")) {
20459      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
20460      for (int i = 0; i < array.size(); i++) {
20461        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
20462      }
20463    }
20464    ;
20465    if (json.has("manufacturer")) {
20466      JsonArray array = json.getAsJsonArray("manufacturer");
20467      for (int i = 0; i < array.size(); i++) {
20468        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20469      }
20470    }
20471    ;
20472  }
20473
20474  protected MedicinalProductPharmaceutical parseMedicinalProductPharmaceutical(JsonObject json)
20475      throws IOException, FHIRFormatError {
20476    MedicinalProductPharmaceutical res = new MedicinalProductPharmaceutical();
20477    parseMedicinalProductPharmaceuticalProperties(json, res);
20478    return res;
20479  }
20480
20481  protected void parseMedicinalProductPharmaceuticalProperties(JsonObject json, MedicinalProductPharmaceutical res)
20482      throws IOException, FHIRFormatError {
20483    parseDomainResourceProperties(json, res);
20484    if (json.has("identifier")) {
20485      JsonArray array = json.getAsJsonArray("identifier");
20486      for (int i = 0; i < array.size(); i++) {
20487        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20488      }
20489    }
20490    ;
20491    if (json.has("administrableDoseForm"))
20492      res.setAdministrableDoseForm(parseCodeableConcept(getJObject(json, "administrableDoseForm")));
20493    if (json.has("unitOfPresentation"))
20494      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
20495    if (json.has("ingredient")) {
20496      JsonArray array = json.getAsJsonArray("ingredient");
20497      for (int i = 0; i < array.size(); i++) {
20498        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
20499      }
20500    }
20501    ;
20502    if (json.has("device")) {
20503      JsonArray array = json.getAsJsonArray("device");
20504      for (int i = 0; i < array.size(); i++) {
20505        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
20506      }
20507    }
20508    ;
20509    if (json.has("characteristics")) {
20510      JsonArray array = json.getAsJsonArray("characteristics");
20511      for (int i = 0; i < array.size(); i++) {
20512        res.getCharacteristics()
20513            .add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(
20514                array.get(i).getAsJsonObject(), res));
20515      }
20516    }
20517    ;
20518    if (json.has("routeOfAdministration")) {
20519      JsonArray array = json.getAsJsonArray("routeOfAdministration");
20520      for (int i = 0; i < array.size(); i++) {
20521        res.getRouteOfAdministration()
20522            .add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(
20523                array.get(i).getAsJsonObject(), res));
20524      }
20525    }
20526    ;
20527  }
20528
20529  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(
20530      JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
20531    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
20532    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(json, owner,
20533        res);
20534    return res;
20535  }
20536
20537  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(
20538      JsonObject json, MedicinalProductPharmaceutical owner,
20539      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res)
20540      throws IOException, FHIRFormatError {
20541    parseBackboneElementProperties(json, res);
20542    if (json.has("code"))
20543      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20544    if (json.has("status"))
20545      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
20546  }
20547
20548  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(
20549      JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
20550    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
20551    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(json,
20552        owner, res);
20553    return res;
20554  }
20555
20556  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(
20557      JsonObject json, MedicinalProductPharmaceutical owner,
20558      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res)
20559      throws IOException, FHIRFormatError {
20560    parseBackboneElementProperties(json, res);
20561    if (json.has("code"))
20562      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20563    if (json.has("firstDose"))
20564      res.setFirstDose(parseQuantity(getJObject(json, "firstDose")));
20565    if (json.has("maxSingleDose"))
20566      res.setMaxSingleDose(parseQuantity(getJObject(json, "maxSingleDose")));
20567    if (json.has("maxDosePerDay"))
20568      res.setMaxDosePerDay(parseQuantity(getJObject(json, "maxDosePerDay")));
20569    if (json.has("maxDosePerTreatmentPeriod"))
20570      res.setMaxDosePerTreatmentPeriod(parseRatio(getJObject(json, "maxDosePerTreatmentPeriod")));
20571    if (json.has("maxTreatmentPeriod"))
20572      res.setMaxTreatmentPeriod(parseDuration(getJObject(json, "maxTreatmentPeriod")));
20573    if (json.has("targetSpecies")) {
20574      JsonArray array = json.getAsJsonArray("targetSpecies");
20575      for (int i = 0; i < array.size(); i++) {
20576        res.getTargetSpecies().add(
20577            parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
20578                array.get(i).getAsJsonObject(), owner));
20579      }
20580    }
20581    ;
20582  }
20583
20584  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
20585      JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
20586    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
20587    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(
20588        json, owner, res);
20589    return res;
20590  }
20591
20592  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(
20593      JsonObject json, MedicinalProductPharmaceutical owner,
20594      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res)
20595      throws IOException, FHIRFormatError {
20596    parseBackboneElementProperties(json, res);
20597    if (json.has("code"))
20598      res.setCode(parseCodeableConcept(getJObject(json, "code")));
20599    if (json.has("withdrawalPeriod")) {
20600      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
20601      for (int i = 0; i < array.size(); i++) {
20602        res.getWithdrawalPeriod().add(
20603            parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
20604                array.get(i).getAsJsonObject(), owner));
20605      }
20606    }
20607    ;
20608  }
20609
20610  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
20611      JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
20612    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
20613    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(
20614        json, owner, res);
20615    return res;
20616  }
20617
20618  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(
20619      JsonObject json, MedicinalProductPharmaceutical owner,
20620      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res)
20621      throws IOException, FHIRFormatError {
20622    parseBackboneElementProperties(json, res);
20623    if (json.has("tissue"))
20624      res.setTissue(parseCodeableConcept(getJObject(json, "tissue")));
20625    if (json.has("value"))
20626      res.setValue(parseQuantity(getJObject(json, "value")));
20627    if (json.has("supportingInformation"))
20628      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
20629    if (json.has("_supportingInformation"))
20630      parseElementProperties(getJObject(json, "_supportingInformation"), res.getSupportingInformationElement());
20631  }
20632
20633  protected MedicinalProductUndesirableEffect parseMedicinalProductUndesirableEffect(JsonObject json)
20634      throws IOException, FHIRFormatError {
20635    MedicinalProductUndesirableEffect res = new MedicinalProductUndesirableEffect();
20636    parseMedicinalProductUndesirableEffectProperties(json, res);
20637    return res;
20638  }
20639
20640  protected void parseMedicinalProductUndesirableEffectProperties(JsonObject json,
20641      MedicinalProductUndesirableEffect res) throws IOException, FHIRFormatError {
20642    parseDomainResourceProperties(json, res);
20643    if (json.has("subject")) {
20644      JsonArray array = json.getAsJsonArray("subject");
20645      for (int i = 0; i < array.size(); i++) {
20646        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
20647      }
20648    }
20649    ;
20650    if (json.has("symptomConditionEffect"))
20651      res.setSymptomConditionEffect(parseCodeableConcept(getJObject(json, "symptomConditionEffect")));
20652    if (json.has("classification"))
20653      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
20654    if (json.has("frequencyOfOccurrence"))
20655      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
20656    if (json.has("population")) {
20657      JsonArray array = json.getAsJsonArray("population");
20658      for (int i = 0; i < array.size(); i++) {
20659        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
20660      }
20661    }
20662    ;
20663  }
20664
20665  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
20666    MessageDefinition res = new MessageDefinition();
20667    parseMessageDefinitionProperties(json, res);
20668    return res;
20669  }
20670
20671  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res)
20672      throws IOException, FHIRFormatError {
20673    parseDomainResourceProperties(json, res);
20674    if (json.has("url"))
20675      res.setUrlElement(parseUri(json.get("url").getAsString()));
20676    if (json.has("_url"))
20677      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
20678    if (json.has("identifier")) {
20679      JsonArray array = json.getAsJsonArray("identifier");
20680      for (int i = 0; i < array.size(); i++) {
20681        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20682      }
20683    }
20684    ;
20685    if (json.has("version"))
20686      res.setVersionElement(parseString(json.get("version").getAsString()));
20687    if (json.has("_version"))
20688      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
20689    if (json.has("name"))
20690      res.setNameElement(parseString(json.get("name").getAsString()));
20691    if (json.has("_name"))
20692      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20693    if (json.has("title"))
20694      res.setTitleElement(parseString(json.get("title").getAsString()));
20695    if (json.has("_title"))
20696      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20697    if (json.has("replaces")) {
20698      JsonArray array = json.getAsJsonArray("replaces");
20699      for (int i = 0; i < array.size(); i++) {
20700        if (array.get(i).isJsonNull()) {
20701          res.getReplaces().add(new CanonicalType());
20702        } else {
20703          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
20704        }
20705      }
20706    }
20707    ;
20708    if (json.has("_replaces")) {
20709      JsonArray array = json.getAsJsonArray("_replaces");
20710      for (int i = 0; i < array.size(); i++) {
20711        if (i == res.getReplaces().size())
20712          res.getReplaces().add(parseCanonical(null));
20713        if (array.get(i) instanceof JsonObject)
20714          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
20715      }
20716    }
20717    ;
20718    if (json.has("status"))
20719      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
20720          new Enumerations.PublicationStatusEnumFactory()));
20721    if (json.has("_status"))
20722      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20723    if (json.has("experimental"))
20724      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20725    if (json.has("_experimental"))
20726      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
20727    if (json.has("date"))
20728      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20729    if (json.has("_date"))
20730      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20731    if (json.has("publisher"))
20732      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20733    if (json.has("_publisher"))
20734      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
20735    if (json.has("contact")) {
20736      JsonArray array = json.getAsJsonArray("contact");
20737      for (int i = 0; i < array.size(); i++) {
20738        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20739      }
20740    }
20741    ;
20742    if (json.has("description"))
20743      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20744    if (json.has("_description"))
20745      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20746    if (json.has("useContext")) {
20747      JsonArray array = json.getAsJsonArray("useContext");
20748      for (int i = 0; i < array.size(); i++) {
20749        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20750      }
20751    }
20752    ;
20753    if (json.has("jurisdiction")) {
20754      JsonArray array = json.getAsJsonArray("jurisdiction");
20755      for (int i = 0; i < array.size(); i++) {
20756        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20757      }
20758    }
20759    ;
20760    if (json.has("purpose"))
20761      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20762    if (json.has("_purpose"))
20763      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
20764    if (json.has("copyright"))
20765      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20766    if (json.has("_copyright"))
20767      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
20768    if (json.has("base"))
20769      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
20770    if (json.has("_base"))
20771      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
20772    if (json.has("parent")) {
20773      JsonArray array = json.getAsJsonArray("parent");
20774      for (int i = 0; i < array.size(); i++) {
20775        if (array.get(i).isJsonNull()) {
20776          res.getParent().add(new CanonicalType());
20777        } else {
20778          res.getParent().add(parseCanonical(array.get(i).getAsString()));
20779        }
20780      }
20781    }
20782    ;
20783    if (json.has("_parent")) {
20784      JsonArray array = json.getAsJsonArray("_parent");
20785      for (int i = 0; i < array.size(); i++) {
20786        if (i == res.getParent().size())
20787          res.getParent().add(parseCanonical(null));
20788        if (array.get(i) instanceof JsonObject)
20789          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
20790      }
20791    }
20792    ;
20793    Type event = parseType("event", json);
20794    if (event != null)
20795      res.setEvent(event);
20796    if (json.has("category"))
20797      res.setCategoryElement(
20798          parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL,
20799              new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
20800    if (json.has("_category"))
20801      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
20802    if (json.has("focus")) {
20803      JsonArray array = json.getAsJsonArray("focus");
20804      for (int i = 0; i < array.size(); i++) {
20805        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
20806      }
20807    }
20808    ;
20809    if (json.has("responseRequired"))
20810      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(),
20811          MessageDefinition.MessageheaderResponseRequest.NULL,
20812          new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
20813    if (json.has("_responseRequired"))
20814      parseElementProperties(getJObject(json, "_responseRequired"), res.getResponseRequiredElement());
20815    if (json.has("allowedResponse")) {
20816      JsonArray array = json.getAsJsonArray("allowedResponse");
20817      for (int i = 0; i < array.size(); i++) {
20818        res.getAllowedResponse()
20819            .add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
20820      }
20821    }
20822    ;
20823    if (json.has("graph")) {
20824      JsonArray array = json.getAsJsonArray("graph");
20825      for (int i = 0; i < array.size(); i++) {
20826        if (array.get(i).isJsonNull()) {
20827          res.getGraph().add(new CanonicalType());
20828        } else {
20829          res.getGraph().add(parseCanonical(array.get(i).getAsString()));
20830        }
20831      }
20832    }
20833    ;
20834    if (json.has("_graph")) {
20835      JsonArray array = json.getAsJsonArray("_graph");
20836      for (int i = 0; i < array.size(); i++) {
20837        if (i == res.getGraph().size())
20838          res.getGraph().add(parseCanonical(null));
20839        if (array.get(i) instanceof JsonObject)
20840          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
20841      }
20842    }
20843    ;
20844  }
20845
20846  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(
20847      JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
20848    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
20849    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
20850    return res;
20851  }
20852
20853  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json,
20854      MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res)
20855      throws IOException, FHIRFormatError {
20856    parseBackboneElementProperties(json, res);
20857    if (json.has("code"))
20858      res.setCodeElement(parseCode(json.get("code").getAsString()));
20859    if (json.has("_code"))
20860      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
20861    if (json.has("profile"))
20862      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
20863    if (json.has("_profile"))
20864      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
20865    if (json.has("min"))
20866      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
20867    if (json.has("_min"))
20868      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
20869    if (json.has("max"))
20870      res.setMaxElement(parseString(json.get("max").getAsString()));
20871    if (json.has("_max"))
20872      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
20873  }
20874
20875  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(
20876      JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
20877    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
20878    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
20879    return res;
20880  }
20881
20882  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json,
20883      MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res)
20884      throws IOException, FHIRFormatError {
20885    parseBackboneElementProperties(json, res);
20886    if (json.has("message"))
20887      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
20888    if (json.has("_message"))
20889      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
20890    if (json.has("situation"))
20891      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
20892    if (json.has("_situation"))
20893      parseElementProperties(getJObject(json, "_situation"), res.getSituationElement());
20894  }
20895
20896  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
20897    MessageHeader res = new MessageHeader();
20898    parseMessageHeaderProperties(json, res);
20899    return res;
20900  }
20901
20902  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
20903    parseDomainResourceProperties(json, res);
20904    Type event = parseType("event", json);
20905    if (event != null)
20906      res.setEvent(event);
20907    if (json.has("destination")) {
20908      JsonArray array = json.getAsJsonArray("destination");
20909      for (int i = 0; i < array.size(); i++) {
20910        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
20911      }
20912    }
20913    ;
20914    if (json.has("sender"))
20915      res.setSender(parseReference(getJObject(json, "sender")));
20916    if (json.has("enterer"))
20917      res.setEnterer(parseReference(getJObject(json, "enterer")));
20918    if (json.has("author"))
20919      res.setAuthor(parseReference(getJObject(json, "author")));
20920    if (json.has("source"))
20921      res.setSource(parseMessageHeaderMessageSourceComponent(getJObject(json, "source"), res));
20922    if (json.has("responsible"))
20923      res.setResponsible(parseReference(getJObject(json, "responsible")));
20924    if (json.has("reason"))
20925      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
20926    if (json.has("response"))
20927      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(getJObject(json, "response"), res));
20928    if (json.has("focus")) {
20929      JsonArray array = json.getAsJsonArray("focus");
20930      for (int i = 0; i < array.size(); i++) {
20931        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
20932      }
20933    }
20934    ;
20935    if (json.has("definition"))
20936      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
20937    if (json.has("_definition"))
20938      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
20939  }
20940
20941  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json,
20942      MessageHeader owner) throws IOException, FHIRFormatError {
20943    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
20944    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
20945    return res;
20946  }
20947
20948  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner,
20949      MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
20950    parseBackboneElementProperties(json, res);
20951    if (json.has("name"))
20952      res.setNameElement(parseString(json.get("name").getAsString()));
20953    if (json.has("_name"))
20954      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20955    if (json.has("target"))
20956      res.setTarget(parseReference(getJObject(json, "target")));
20957    if (json.has("endpoint"))
20958      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
20959    if (json.has("_endpoint"))
20960      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
20961    if (json.has("receiver"))
20962      res.setReceiver(parseReference(getJObject(json, "receiver")));
20963  }
20964
20965  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json,
20966      MessageHeader owner) throws IOException, FHIRFormatError {
20967    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
20968    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
20969    return res;
20970  }
20971
20972  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner,
20973      MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
20974    parseBackboneElementProperties(json, res);
20975    if (json.has("name"))
20976      res.setNameElement(parseString(json.get("name").getAsString()));
20977    if (json.has("_name"))
20978      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20979    if (json.has("software"))
20980      res.setSoftwareElement(parseString(json.get("software").getAsString()));
20981    if (json.has("_software"))
20982      parseElementProperties(getJObject(json, "_software"), res.getSoftwareElement());
20983    if (json.has("version"))
20984      res.setVersionElement(parseString(json.get("version").getAsString()));
20985    if (json.has("_version"))
20986      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
20987    if (json.has("contact"))
20988      res.setContact(parseContactPoint(getJObject(json, "contact")));
20989    if (json.has("endpoint"))
20990      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
20991    if (json.has("_endpoint"))
20992      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
20993  }
20994
20995  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(
20996      JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
20997    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
20998    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
20999    return res;
21000  }
21001
21002  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner,
21003      MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
21004    parseBackboneElementProperties(json, res);
21005    if (json.has("identifier"))
21006      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
21007    if (json.has("_identifier"))
21008      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
21009    if (json.has("code"))
21010      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL,
21011          new MessageHeader.ResponseTypeEnumFactory()));
21012    if (json.has("_code"))
21013      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
21014    if (json.has("details"))
21015      res.setDetails(parseReference(getJObject(json, "details")));
21016  }
21017
21018  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
21019    MolecularSequence res = new MolecularSequence();
21020    parseMolecularSequenceProperties(json, res);
21021    return res;
21022  }
21023
21024  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res)
21025      throws IOException, FHIRFormatError {
21026    parseDomainResourceProperties(json, res);
21027    if (json.has("identifier")) {
21028      JsonArray array = json.getAsJsonArray("identifier");
21029      for (int i = 0; i < array.size(); i++) {
21030        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21031      }
21032    }
21033    ;
21034    if (json.has("type"))
21035      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL,
21036          new MolecularSequence.SequenceTypeEnumFactory()));
21037    if (json.has("_type"))
21038      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21039    if (json.has("coordinateSystem"))
21040      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
21041    if (json.has("_coordinateSystem"))
21042      parseElementProperties(getJObject(json, "_coordinateSystem"), res.getCoordinateSystemElement());
21043    if (json.has("patient"))
21044      res.setPatient(parseReference(getJObject(json, "patient")));
21045    if (json.has("specimen"))
21046      res.setSpecimen(parseReference(getJObject(json, "specimen")));
21047    if (json.has("device"))
21048      res.setDevice(parseReference(getJObject(json, "device")));
21049    if (json.has("performer"))
21050      res.setPerformer(parseReference(getJObject(json, "performer")));
21051    if (json.has("quantity"))
21052      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
21053    if (json.has("referenceSeq"))
21054      res.setReferenceSeq(
21055          parseMolecularSequenceMolecularSequenceReferenceSeqComponent(getJObject(json, "referenceSeq"), res));
21056    if (json.has("variant")) {
21057      JsonArray array = json.getAsJsonArray("variant");
21058      for (int i = 0; i < array.size(); i++) {
21059        res.getVariant()
21060            .add(parseMolecularSequenceMolecularSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
21061      }
21062    }
21063    ;
21064    if (json.has("observedSeq"))
21065      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
21066    if (json.has("_observedSeq"))
21067      parseElementProperties(getJObject(json, "_observedSeq"), res.getObservedSeqElement());
21068    if (json.has("quality")) {
21069      JsonArray array = json.getAsJsonArray("quality");
21070      for (int i = 0; i < array.size(); i++) {
21071        res.getQuality()
21072            .add(parseMolecularSequenceMolecularSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
21073      }
21074    }
21075    ;
21076    if (json.has("readCoverage"))
21077      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
21078    if (json.has("_readCoverage"))
21079      parseElementProperties(getJObject(json, "_readCoverage"), res.getReadCoverageElement());
21080    if (json.has("repository")) {
21081      JsonArray array = json.getAsJsonArray("repository");
21082      for (int i = 0; i < array.size(); i++) {
21083        res.getRepository()
21084            .add(parseMolecularSequenceMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
21085      }
21086    }
21087    ;
21088    if (json.has("pointer")) {
21089      JsonArray array = json.getAsJsonArray("pointer");
21090      for (int i = 0; i < array.size(); i++) {
21091        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
21092      }
21093    }
21094    ;
21095    if (json.has("structureVariant")) {
21096      JsonArray array = json.getAsJsonArray("structureVariant");
21097      for (int i = 0; i < array.size(); i++) {
21098        res.getStructureVariant()
21099            .add(parseMolecularSequenceMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
21100      }
21101    }
21102    ;
21103  }
21104
21105  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceMolecularSequenceReferenceSeqComponent(
21106      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21107    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
21108    parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(json, owner, res);
21109    return res;
21110  }
21111
21112  protected void parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(JsonObject json,
21113      MolecularSequence owner, MolecularSequence.MolecularSequenceReferenceSeqComponent res)
21114      throws IOException, FHIRFormatError {
21115    parseBackboneElementProperties(json, res);
21116    if (json.has("chromosome"))
21117      res.setChromosome(parseCodeableConcept(getJObject(json, "chromosome")));
21118    if (json.has("genomeBuild"))
21119      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
21120    if (json.has("_genomeBuild"))
21121      parseElementProperties(getJObject(json, "_genomeBuild"), res.getGenomeBuildElement());
21122    if (json.has("orientation"))
21123      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(),
21124          MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
21125    if (json.has("_orientation"))
21126      parseElementProperties(getJObject(json, "_orientation"), res.getOrientationElement());
21127    if (json.has("referenceSeqId"))
21128      res.setReferenceSeqId(parseCodeableConcept(getJObject(json, "referenceSeqId")));
21129    if (json.has("referenceSeqPointer"))
21130      res.setReferenceSeqPointer(parseReference(getJObject(json, "referenceSeqPointer")));
21131    if (json.has("referenceSeqString"))
21132      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
21133    if (json.has("_referenceSeqString"))
21134      parseElementProperties(getJObject(json, "_referenceSeqString"), res.getReferenceSeqStringElement());
21135    if (json.has("strand"))
21136      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL,
21137          new MolecularSequence.StrandTypeEnumFactory()));
21138    if (json.has("_strand"))
21139      parseElementProperties(getJObject(json, "_strand"), res.getStrandElement());
21140    if (json.has("windowStart"))
21141      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
21142    if (json.has("_windowStart"))
21143      parseElementProperties(getJObject(json, "_windowStart"), res.getWindowStartElement());
21144    if (json.has("windowEnd"))
21145      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
21146    if (json.has("_windowEnd"))
21147      parseElementProperties(getJObject(json, "_windowEnd"), res.getWindowEndElement());
21148  }
21149
21150  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceMolecularSequenceVariantComponent(
21151      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21152    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
21153    parseMolecularSequenceMolecularSequenceVariantComponentProperties(json, owner, res);
21154    return res;
21155  }
21156
21157  protected void parseMolecularSequenceMolecularSequenceVariantComponentProperties(JsonObject json,
21158      MolecularSequence owner, MolecularSequence.MolecularSequenceVariantComponent res)
21159      throws IOException, FHIRFormatError {
21160    parseBackboneElementProperties(json, res);
21161    if (json.has("start"))
21162      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21163    if (json.has("_start"))
21164      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
21165    if (json.has("end"))
21166      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21167    if (json.has("_end"))
21168      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
21169    if (json.has("observedAllele"))
21170      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
21171    if (json.has("_observedAllele"))
21172      parseElementProperties(getJObject(json, "_observedAllele"), res.getObservedAlleleElement());
21173    if (json.has("referenceAllele"))
21174      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
21175    if (json.has("_referenceAllele"))
21176      parseElementProperties(getJObject(json, "_referenceAllele"), res.getReferenceAlleleElement());
21177    if (json.has("cigar"))
21178      res.setCigarElement(parseString(json.get("cigar").getAsString()));
21179    if (json.has("_cigar"))
21180      parseElementProperties(getJObject(json, "_cigar"), res.getCigarElement());
21181    if (json.has("variantPointer"))
21182      res.setVariantPointer(parseReference(getJObject(json, "variantPointer")));
21183  }
21184
21185  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceMolecularSequenceQualityComponent(
21186      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21187    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
21188    parseMolecularSequenceMolecularSequenceQualityComponentProperties(json, owner, res);
21189    return res;
21190  }
21191
21192  protected void parseMolecularSequenceMolecularSequenceQualityComponentProperties(JsonObject json,
21193      MolecularSequence owner, MolecularSequence.MolecularSequenceQualityComponent res)
21194      throws IOException, FHIRFormatError {
21195    parseBackboneElementProperties(json, res);
21196    if (json.has("type"))
21197      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL,
21198          new MolecularSequence.QualityTypeEnumFactory()));
21199    if (json.has("_type"))
21200      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21201    if (json.has("standardSequence"))
21202      res.setStandardSequence(parseCodeableConcept(getJObject(json, "standardSequence")));
21203    if (json.has("start"))
21204      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21205    if (json.has("_start"))
21206      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
21207    if (json.has("end"))
21208      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21209    if (json.has("_end"))
21210      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
21211    if (json.has("score"))
21212      res.setScore(parseQuantity(getJObject(json, "score")));
21213    if (json.has("method"))
21214      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
21215    if (json.has("truthTP"))
21216      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
21217    if (json.has("_truthTP"))
21218      parseElementProperties(getJObject(json, "_truthTP"), res.getTruthTPElement());
21219    if (json.has("queryTP"))
21220      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
21221    if (json.has("_queryTP"))
21222      parseElementProperties(getJObject(json, "_queryTP"), res.getQueryTPElement());
21223    if (json.has("truthFN"))
21224      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
21225    if (json.has("_truthFN"))
21226      parseElementProperties(getJObject(json, "_truthFN"), res.getTruthFNElement());
21227    if (json.has("queryFP"))
21228      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
21229    if (json.has("_queryFP"))
21230      parseElementProperties(getJObject(json, "_queryFP"), res.getQueryFPElement());
21231    if (json.has("gtFP"))
21232      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
21233    if (json.has("_gtFP"))
21234      parseElementProperties(getJObject(json, "_gtFP"), res.getGtFPElement());
21235    if (json.has("precision"))
21236      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
21237    if (json.has("_precision"))
21238      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
21239    if (json.has("recall"))
21240      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
21241    if (json.has("_recall"))
21242      parseElementProperties(getJObject(json, "_recall"), res.getRecallElement());
21243    if (json.has("fScore"))
21244      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
21245    if (json.has("_fScore"))
21246      parseElementProperties(getJObject(json, "_fScore"), res.getFScoreElement());
21247    if (json.has("roc"))
21248      res.setRoc(parseMolecularSequenceMolecularSequenceQualityRocComponent(getJObject(json, "roc"), owner));
21249  }
21250
21251  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceMolecularSequenceQualityRocComponent(
21252      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21253    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
21254    parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(json, owner, res);
21255    return res;
21256  }
21257
21258  protected void parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(JsonObject json,
21259      MolecularSequence owner, MolecularSequence.MolecularSequenceQualityRocComponent res)
21260      throws IOException, FHIRFormatError {
21261    parseBackboneElementProperties(json, res);
21262    if (json.has("score")) {
21263      JsonArray array = json.getAsJsonArray("score");
21264      for (int i = 0; i < array.size(); i++) {
21265        if (array.get(i).isJsonNull()) {
21266          res.getScore().add(new IntegerType());
21267        } else {
21268          res.getScore().add(parseInteger(array.get(i).getAsLong()));
21269        }
21270      }
21271    }
21272    ;
21273    if (json.has("_score")) {
21274      JsonArray array = json.getAsJsonArray("_score");
21275      for (int i = 0; i < array.size(); i++) {
21276        if (i == res.getScore().size())
21277          res.getScore().add(parseInteger(null));
21278        if (array.get(i) instanceof JsonObject)
21279          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
21280      }
21281    }
21282    ;
21283    if (json.has("numTP")) {
21284      JsonArray array = json.getAsJsonArray("numTP");
21285      for (int i = 0; i < array.size(); i++) {
21286        if (array.get(i).isJsonNull()) {
21287          res.getNumTP().add(new IntegerType());
21288        } else {
21289          res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
21290        }
21291      }
21292    }
21293    ;
21294    if (json.has("_numTP")) {
21295      JsonArray array = json.getAsJsonArray("_numTP");
21296      for (int i = 0; i < array.size(); i++) {
21297        if (i == res.getNumTP().size())
21298          res.getNumTP().add(parseInteger(null));
21299        if (array.get(i) instanceof JsonObject)
21300          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
21301      }
21302    }
21303    ;
21304    if (json.has("numFP")) {
21305      JsonArray array = json.getAsJsonArray("numFP");
21306      for (int i = 0; i < array.size(); i++) {
21307        if (array.get(i).isJsonNull()) {
21308          res.getNumFP().add(new IntegerType());
21309        } else {
21310          res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
21311        }
21312      }
21313    }
21314    ;
21315    if (json.has("_numFP")) {
21316      JsonArray array = json.getAsJsonArray("_numFP");
21317      for (int i = 0; i < array.size(); i++) {
21318        if (i == res.getNumFP().size())
21319          res.getNumFP().add(parseInteger(null));
21320        if (array.get(i) instanceof JsonObject)
21321          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
21322      }
21323    }
21324    ;
21325    if (json.has("numFN")) {
21326      JsonArray array = json.getAsJsonArray("numFN");
21327      for (int i = 0; i < array.size(); i++) {
21328        if (array.get(i).isJsonNull()) {
21329          res.getNumFN().add(new IntegerType());
21330        } else {
21331          res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
21332        }
21333      }
21334    }
21335    ;
21336    if (json.has("_numFN")) {
21337      JsonArray array = json.getAsJsonArray("_numFN");
21338      for (int i = 0; i < array.size(); i++) {
21339        if (i == res.getNumFN().size())
21340          res.getNumFN().add(parseInteger(null));
21341        if (array.get(i) instanceof JsonObject)
21342          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
21343      }
21344    }
21345    ;
21346    if (json.has("precision")) {
21347      JsonArray array = json.getAsJsonArray("precision");
21348      for (int i = 0; i < array.size(); i++) {
21349        if (array.get(i).isJsonNull()) {
21350          res.getPrecision().add(new DecimalType());
21351        } else {
21352          res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
21353        }
21354      }
21355    }
21356    ;
21357    if (json.has("_precision")) {
21358      JsonArray array = json.getAsJsonArray("_precision");
21359      for (int i = 0; i < array.size(); i++) {
21360        if (i == res.getPrecision().size())
21361          res.getPrecision().add(parseDecimal(null));
21362        if (array.get(i) instanceof JsonObject)
21363          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
21364      }
21365    }
21366    ;
21367    if (json.has("sensitivity")) {
21368      JsonArray array = json.getAsJsonArray("sensitivity");
21369      for (int i = 0; i < array.size(); i++) {
21370        if (array.get(i).isJsonNull()) {
21371          res.getSensitivity().add(new DecimalType());
21372        } else {
21373          res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
21374        }
21375      }
21376    }
21377    ;
21378    if (json.has("_sensitivity")) {
21379      JsonArray array = json.getAsJsonArray("_sensitivity");
21380      for (int i = 0; i < array.size(); i++) {
21381        if (i == res.getSensitivity().size())
21382          res.getSensitivity().add(parseDecimal(null));
21383        if (array.get(i) instanceof JsonObject)
21384          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
21385      }
21386    }
21387    ;
21388    if (json.has("fMeasure")) {
21389      JsonArray array = json.getAsJsonArray("fMeasure");
21390      for (int i = 0; i < array.size(); i++) {
21391        if (array.get(i).isJsonNull()) {
21392          res.getFMeasure().add(new DecimalType());
21393        } else {
21394          res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
21395        }
21396      }
21397    }
21398    ;
21399    if (json.has("_fMeasure")) {
21400      JsonArray array = json.getAsJsonArray("_fMeasure");
21401      for (int i = 0; i < array.size(); i++) {
21402        if (i == res.getFMeasure().size())
21403          res.getFMeasure().add(parseDecimal(null));
21404        if (array.get(i) instanceof JsonObject)
21405          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
21406      }
21407    }
21408    ;
21409  }
21410
21411  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceMolecularSequenceRepositoryComponent(
21412      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21413    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
21414    parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(json, owner, res);
21415    return res;
21416  }
21417
21418  protected void parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(JsonObject json,
21419      MolecularSequence owner, MolecularSequence.MolecularSequenceRepositoryComponent res)
21420      throws IOException, FHIRFormatError {
21421    parseBackboneElementProperties(json, res);
21422    if (json.has("type"))
21423      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL,
21424          new MolecularSequence.RepositoryTypeEnumFactory()));
21425    if (json.has("_type"))
21426      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21427    if (json.has("url"))
21428      res.setUrlElement(parseUri(json.get("url").getAsString()));
21429    if (json.has("_url"))
21430      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
21431    if (json.has("name"))
21432      res.setNameElement(parseString(json.get("name").getAsString()));
21433    if (json.has("_name"))
21434      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21435    if (json.has("datasetId"))
21436      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
21437    if (json.has("_datasetId"))
21438      parseElementProperties(getJObject(json, "_datasetId"), res.getDatasetIdElement());
21439    if (json.has("variantsetId"))
21440      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
21441    if (json.has("_variantsetId"))
21442      parseElementProperties(getJObject(json, "_variantsetId"), res.getVariantsetIdElement());
21443    if (json.has("readsetId"))
21444      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
21445    if (json.has("_readsetId"))
21446      parseElementProperties(getJObject(json, "_readsetId"), res.getReadsetIdElement());
21447  }
21448
21449  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceMolecularSequenceStructureVariantComponent(
21450      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21451    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
21452    parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(json, owner, res);
21453    return res;
21454  }
21455
21456  protected void parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(JsonObject json,
21457      MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantComponent res)
21458      throws IOException, FHIRFormatError {
21459    parseBackboneElementProperties(json, res);
21460    if (json.has("variantType"))
21461      res.setVariantType(parseCodeableConcept(getJObject(json, "variantType")));
21462    if (json.has("exact"))
21463      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
21464    if (json.has("_exact"))
21465      parseElementProperties(getJObject(json, "_exact"), res.getExactElement());
21466    if (json.has("length"))
21467      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
21468    if (json.has("_length"))
21469      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
21470    if (json.has("outer"))
21471      res.setOuter(
21472          parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(getJObject(json, "outer"), owner));
21473    if (json.has("inner"))
21474      res.setInner(
21475          parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(getJObject(json, "inner"), owner));
21476  }
21477
21478  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(
21479      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21480    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
21481    parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(json, owner, res);
21482    return res;
21483  }
21484
21485  protected void parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json,
21486      MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res)
21487      throws IOException, FHIRFormatError {
21488    parseBackboneElementProperties(json, res);
21489    if (json.has("start"))
21490      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21491    if (json.has("_start"))
21492      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
21493    if (json.has("end"))
21494      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21495    if (json.has("_end"))
21496      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
21497  }
21498
21499  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(
21500      JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
21501    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
21502    parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(json, owner, res);
21503    return res;
21504  }
21505
21506  protected void parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json,
21507      MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res)
21508      throws IOException, FHIRFormatError {
21509    parseBackboneElementProperties(json, res);
21510    if (json.has("start"))
21511      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21512    if (json.has("_start"))
21513      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
21514    if (json.has("end"))
21515      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21516    if (json.has("_end"))
21517      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
21518  }
21519
21520  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
21521    NamingSystem res = new NamingSystem();
21522    parseNamingSystemProperties(json, res);
21523    return res;
21524  }
21525
21526  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
21527    parseDomainResourceProperties(json, res);
21528    if (json.has("name"))
21529      res.setNameElement(parseString(json.get("name").getAsString()));
21530    if (json.has("_name"))
21531      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21532    if (json.has("status"))
21533      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
21534          new Enumerations.PublicationStatusEnumFactory()));
21535    if (json.has("_status"))
21536      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21537    if (json.has("kind"))
21538      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL,
21539          new NamingSystem.NamingSystemTypeEnumFactory()));
21540    if (json.has("_kind"))
21541      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
21542    if (json.has("date"))
21543      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21544    if (json.has("_date"))
21545      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21546    if (json.has("publisher"))
21547      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21548    if (json.has("_publisher"))
21549      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
21550    if (json.has("contact")) {
21551      JsonArray array = json.getAsJsonArray("contact");
21552      for (int i = 0; i < array.size(); i++) {
21553        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21554      }
21555    }
21556    ;
21557    if (json.has("responsible"))
21558      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
21559    if (json.has("_responsible"))
21560      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
21561    if (json.has("type"))
21562      res.setType(parseCodeableConcept(getJObject(json, "type")));
21563    if (json.has("description"))
21564      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21565    if (json.has("_description"))
21566      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21567    if (json.has("useContext")) {
21568      JsonArray array = json.getAsJsonArray("useContext");
21569      for (int i = 0; i < array.size(); i++) {
21570        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21571      }
21572    }
21573    ;
21574    if (json.has("jurisdiction")) {
21575      JsonArray array = json.getAsJsonArray("jurisdiction");
21576      for (int i = 0; i < array.size(); i++) {
21577        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21578      }
21579    }
21580    ;
21581    if (json.has("usage"))
21582      res.setUsageElement(parseString(json.get("usage").getAsString()));
21583    if (json.has("_usage"))
21584      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
21585    if (json.has("uniqueId")) {
21586      JsonArray array = json.getAsJsonArray("uniqueId");
21587      for (int i = 0; i < array.size(); i++) {
21588        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
21589      }
21590    }
21591    ;
21592  }
21593
21594  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json,
21595      NamingSystem owner) throws IOException, FHIRFormatError {
21596    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
21597    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
21598    return res;
21599  }
21600
21601  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner,
21602      NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
21603    parseBackboneElementProperties(json, res);
21604    if (json.has("type"))
21605      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL,
21606          new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
21607    if (json.has("_type"))
21608      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21609    if (json.has("value"))
21610      res.setValueElement(parseString(json.get("value").getAsString()));
21611    if (json.has("_value"))
21612      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
21613    if (json.has("preferred"))
21614      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
21615    if (json.has("_preferred"))
21616      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
21617    if (json.has("comment"))
21618      res.setCommentElement(parseString(json.get("comment").getAsString()));
21619    if (json.has("_comment"))
21620      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
21621    if (json.has("period"))
21622      res.setPeriod(parsePeriod(getJObject(json, "period")));
21623  }
21624
21625  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
21626    NutritionOrder res = new NutritionOrder();
21627    parseNutritionOrderProperties(json, res);
21628    return res;
21629  }
21630
21631  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res)
21632      throws IOException, FHIRFormatError {
21633    parseDomainResourceProperties(json, res);
21634    if (json.has("identifier")) {
21635      JsonArray array = json.getAsJsonArray("identifier");
21636      for (int i = 0; i < array.size(); i++) {
21637        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21638      }
21639    }
21640    ;
21641    if (json.has("instantiatesCanonical")) {
21642      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
21643      for (int i = 0; i < array.size(); i++) {
21644        if (array.get(i).isJsonNull()) {
21645          res.getInstantiatesCanonical().add(new CanonicalType());
21646        } else {
21647          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
21648        }
21649      }
21650    }
21651    ;
21652    if (json.has("_instantiatesCanonical")) {
21653      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
21654      for (int i = 0; i < array.size(); i++) {
21655        if (i == res.getInstantiatesCanonical().size())
21656          res.getInstantiatesCanonical().add(parseCanonical(null));
21657        if (array.get(i) instanceof JsonObject)
21658          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
21659      }
21660    }
21661    ;
21662    if (json.has("instantiatesUri")) {
21663      JsonArray array = json.getAsJsonArray("instantiatesUri");
21664      for (int i = 0; i < array.size(); i++) {
21665        if (array.get(i).isJsonNull()) {
21666          res.getInstantiatesUri().add(new UriType());
21667        } else {
21668          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
21669        }
21670      }
21671    }
21672    ;
21673    if (json.has("_instantiatesUri")) {
21674      JsonArray array = json.getAsJsonArray("_instantiatesUri");
21675      for (int i = 0; i < array.size(); i++) {
21676        if (i == res.getInstantiatesUri().size())
21677          res.getInstantiatesUri().add(parseUri(null));
21678        if (array.get(i) instanceof JsonObject)
21679          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
21680      }
21681    }
21682    ;
21683    if (json.has("instantiates")) {
21684      JsonArray array = json.getAsJsonArray("instantiates");
21685      for (int i = 0; i < array.size(); i++) {
21686        if (array.get(i).isJsonNull()) {
21687          res.getInstantiates().add(new UriType());
21688        } else {
21689          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
21690        }
21691      }
21692    }
21693    ;
21694    if (json.has("_instantiates")) {
21695      JsonArray array = json.getAsJsonArray("_instantiates");
21696      for (int i = 0; i < array.size(); i++) {
21697        if (i == res.getInstantiates().size())
21698          res.getInstantiates().add(parseUri(null));
21699        if (array.get(i) instanceof JsonObject)
21700          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
21701      }
21702    }
21703    ;
21704    if (json.has("status"))
21705      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL,
21706          new NutritionOrder.NutritionOrderStatusEnumFactory()));
21707    if (json.has("_status"))
21708      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21709    if (json.has("intent"))
21710      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL,
21711          new NutritionOrder.NutritiionOrderIntentEnumFactory()));
21712    if (json.has("_intent"))
21713      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
21714    if (json.has("patient"))
21715      res.setPatient(parseReference(getJObject(json, "patient")));
21716    if (json.has("encounter"))
21717      res.setEncounter(parseReference(getJObject(json, "encounter")));
21718    if (json.has("dateTime"))
21719      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
21720    if (json.has("_dateTime"))
21721      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
21722    if (json.has("orderer"))
21723      res.setOrderer(parseReference(getJObject(json, "orderer")));
21724    if (json.has("allergyIntolerance")) {
21725      JsonArray array = json.getAsJsonArray("allergyIntolerance");
21726      for (int i = 0; i < array.size(); i++) {
21727        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
21728      }
21729    }
21730    ;
21731    if (json.has("foodPreferenceModifier")) {
21732      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
21733      for (int i = 0; i < array.size(); i++) {
21734        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21735      }
21736    }
21737    ;
21738    if (json.has("excludeFoodModifier")) {
21739      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
21740      for (int i = 0; i < array.size(); i++) {
21741        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21742      }
21743    }
21744    ;
21745    if (json.has("oralDiet"))
21746      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(getJObject(json, "oralDiet"), res));
21747    if (json.has("supplement")) {
21748      JsonArray array = json.getAsJsonArray("supplement");
21749      for (int i = 0; i < array.size(); i++) {
21750        res.getSupplement()
21751            .add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
21752      }
21753    }
21754    ;
21755    if (json.has("enteralFormula"))
21756      res.setEnteralFormula(
21757          parseNutritionOrderNutritionOrderEnteralFormulaComponent(getJObject(json, "enteralFormula"), res));
21758    if (json.has("note")) {
21759      JsonArray array = json.getAsJsonArray("note");
21760      for (int i = 0; i < array.size(); i++) {
21761        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21762      }
21763    }
21764    ;
21765  }
21766
21767  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(
21768      JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
21769    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
21770    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
21771    return res;
21772  }
21773
21774  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner,
21775      NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
21776    parseBackboneElementProperties(json, res);
21777    if (json.has("type")) {
21778      JsonArray array = json.getAsJsonArray("type");
21779      for (int i = 0; i < array.size(); i++) {
21780        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21781      }
21782    }
21783    ;
21784    if (json.has("schedule")) {
21785      JsonArray array = json.getAsJsonArray("schedule");
21786      for (int i = 0; i < array.size(); i++) {
21787        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
21788      }
21789    }
21790    ;
21791    if (json.has("nutrient")) {
21792      JsonArray array = json.getAsJsonArray("nutrient");
21793      for (int i = 0; i < array.size(); i++) {
21794        res.getNutrient()
21795            .add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
21796      }
21797    }
21798    ;
21799    if (json.has("texture")) {
21800      JsonArray array = json.getAsJsonArray("texture");
21801      for (int i = 0; i < array.size(); i++) {
21802        res.getTexture()
21803            .add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
21804      }
21805    }
21806    ;
21807    if (json.has("fluidConsistencyType")) {
21808      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
21809      for (int i = 0; i < array.size(); i++) {
21810        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21811      }
21812    }
21813    ;
21814    if (json.has("instruction"))
21815      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
21816    if (json.has("_instruction"))
21817      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
21818  }
21819
21820  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(
21821      JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
21822    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
21823    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
21824    return res;
21825  }
21826
21827  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json,
21828      NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res)
21829      throws IOException, FHIRFormatError {
21830    parseBackboneElementProperties(json, res);
21831    if (json.has("modifier"))
21832      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
21833    if (json.has("amount"))
21834      res.setAmount(parseQuantity(getJObject(json, "amount")));
21835  }
21836
21837  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(
21838      JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
21839    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
21840    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
21841    return res;
21842  }
21843
21844  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json,
21845      NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res)
21846      throws IOException, FHIRFormatError {
21847    parseBackboneElementProperties(json, res);
21848    if (json.has("modifier"))
21849      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
21850    if (json.has("foodType"))
21851      res.setFoodType(parseCodeableConcept(getJObject(json, "foodType")));
21852  }
21853
21854  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(
21855      JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
21856    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
21857    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
21858    return res;
21859  }
21860
21861  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner,
21862      NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
21863    parseBackboneElementProperties(json, res);
21864    if (json.has("type"))
21865      res.setType(parseCodeableConcept(getJObject(json, "type")));
21866    if (json.has("productName"))
21867      res.setProductNameElement(parseString(json.get("productName").getAsString()));
21868    if (json.has("_productName"))
21869      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
21870    if (json.has("schedule")) {
21871      JsonArray array = json.getAsJsonArray("schedule");
21872      for (int i = 0; i < array.size(); i++) {
21873        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
21874      }
21875    }
21876    ;
21877    if (json.has("quantity"))
21878      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
21879    if (json.has("instruction"))
21880      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
21881    if (json.has("_instruction"))
21882      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
21883  }
21884
21885  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(
21886      JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
21887    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
21888    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
21889    return res;
21890  }
21891
21892  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json,
21893      NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res)
21894      throws IOException, FHIRFormatError {
21895    parseBackboneElementProperties(json, res);
21896    if (json.has("baseFormulaType"))
21897      res.setBaseFormulaType(parseCodeableConcept(getJObject(json, "baseFormulaType")));
21898    if (json.has("baseFormulaProductName"))
21899      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
21900    if (json.has("_baseFormulaProductName"))
21901      parseElementProperties(getJObject(json, "_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
21902    if (json.has("additiveType"))
21903      res.setAdditiveType(parseCodeableConcept(getJObject(json, "additiveType")));
21904    if (json.has("additiveProductName"))
21905      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
21906    if (json.has("_additiveProductName"))
21907      parseElementProperties(getJObject(json, "_additiveProductName"), res.getAdditiveProductNameElement());
21908    if (json.has("caloricDensity"))
21909      res.setCaloricDensity(parseQuantity(getJObject(json, "caloricDensity")));
21910    if (json.has("routeofAdministration"))
21911      res.setRouteofAdministration(parseCodeableConcept(getJObject(json, "routeofAdministration")));
21912    if (json.has("administration")) {
21913      JsonArray array = json.getAsJsonArray("administration");
21914      for (int i = 0; i < array.size(); i++) {
21915        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(
21916            array.get(i).getAsJsonObject(), owner));
21917      }
21918    }
21919    ;
21920    if (json.has("maxVolumeToDeliver"))
21921      res.setMaxVolumeToDeliver(parseQuantity(getJObject(json, "maxVolumeToDeliver")));
21922    if (json.has("administrationInstruction"))
21923      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
21924    if (json.has("_administrationInstruction"))
21925      parseElementProperties(getJObject(json, "_administrationInstruction"), res.getAdministrationInstructionElement());
21926  }
21927
21928  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(
21929      JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
21930    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
21931    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
21932    return res;
21933  }
21934
21935  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json,
21936      NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res)
21937      throws IOException, FHIRFormatError {
21938    parseBackboneElementProperties(json, res);
21939    if (json.has("schedule"))
21940      res.setSchedule(parseTiming(getJObject(json, "schedule")));
21941    if (json.has("quantity"))
21942      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
21943    Type rate = parseType("rate", json);
21944    if (rate != null)
21945      res.setRate(rate);
21946  }
21947
21948  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
21949    Observation res = new Observation();
21950    parseObservationProperties(json, res);
21951    return res;
21952  }
21953
21954  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
21955    parseDomainResourceProperties(json, res);
21956    if (json.has("identifier")) {
21957      JsonArray array = json.getAsJsonArray("identifier");
21958      for (int i = 0; i < array.size(); i++) {
21959        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21960      }
21961    }
21962    ;
21963    if (json.has("basedOn")) {
21964      JsonArray array = json.getAsJsonArray("basedOn");
21965      for (int i = 0; i < array.size(); i++) {
21966        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21967      }
21968    }
21969    ;
21970    if (json.has("partOf")) {
21971      JsonArray array = json.getAsJsonArray("partOf");
21972      for (int i = 0; i < array.size(); i++) {
21973        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21974      }
21975    }
21976    ;
21977    if (json.has("status"))
21978      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL,
21979          new Observation.ObservationStatusEnumFactory()));
21980    if (json.has("_status"))
21981      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21982    if (json.has("category")) {
21983      JsonArray array = json.getAsJsonArray("category");
21984      for (int i = 0; i < array.size(); i++) {
21985        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21986      }
21987    }
21988    ;
21989    if (json.has("code"))
21990      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21991    if (json.has("subject"))
21992      res.setSubject(parseReference(getJObject(json, "subject")));
21993    if (json.has("focus")) {
21994      JsonArray array = json.getAsJsonArray("focus");
21995      for (int i = 0; i < array.size(); i++) {
21996        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
21997      }
21998    }
21999    ;
22000    if (json.has("encounter"))
22001      res.setEncounter(parseReference(getJObject(json, "encounter")));
22002    Type effective = parseType("effective", json);
22003    if (effective != null)
22004      res.setEffective(effective);
22005    if (json.has("issued"))
22006      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
22007    if (json.has("_issued"))
22008      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
22009    if (json.has("performer")) {
22010      JsonArray array = json.getAsJsonArray("performer");
22011      for (int i = 0; i < array.size(); i++) {
22012        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
22013      }
22014    }
22015    ;
22016    Type value = parseType("value", json);
22017    if (value != null)
22018      res.setValue(value);
22019    if (json.has("dataAbsentReason"))
22020      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
22021    if (json.has("interpretation")) {
22022      JsonArray array = json.getAsJsonArray("interpretation");
22023      for (int i = 0; i < array.size(); i++) {
22024        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22025      }
22026    }
22027    ;
22028    if (json.has("note")) {
22029      JsonArray array = json.getAsJsonArray("note");
22030      for (int i = 0; i < array.size(); i++) {
22031        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22032      }
22033    }
22034    ;
22035    if (json.has("bodySite"))
22036      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
22037    if (json.has("method"))
22038      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
22039    if (json.has("specimen"))
22040      res.setSpecimen(parseReference(getJObject(json, "specimen")));
22041    if (json.has("device"))
22042      res.setDevice(parseReference(getJObject(json, "device")));
22043    if (json.has("referenceRange")) {
22044      JsonArray array = json.getAsJsonArray("referenceRange");
22045      for (int i = 0; i < array.size(); i++) {
22046        res.getReferenceRange()
22047            .add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
22048      }
22049    }
22050    ;
22051    if (json.has("hasMember")) {
22052      JsonArray array = json.getAsJsonArray("hasMember");
22053      for (int i = 0; i < array.size(); i++) {
22054        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
22055      }
22056    }
22057    ;
22058    if (json.has("derivedFrom")) {
22059      JsonArray array = json.getAsJsonArray("derivedFrom");
22060      for (int i = 0; i < array.size(); i++) {
22061        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
22062      }
22063    }
22064    ;
22065    if (json.has("component")) {
22066      JsonArray array = json.getAsJsonArray("component");
22067      for (int i = 0; i < array.size(); i++) {
22068        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
22069      }
22070    }
22071    ;
22072  }
22073
22074  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(
22075      JsonObject json, Observation owner) throws IOException, FHIRFormatError {
22076    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
22077    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
22078    return res;
22079  }
22080
22081  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner,
22082      Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
22083    parseBackboneElementProperties(json, res);
22084    if (json.has("low"))
22085      res.setLow(parseQuantity(getJObject(json, "low")));
22086    if (json.has("high"))
22087      res.setHigh(parseQuantity(getJObject(json, "high")));
22088    if (json.has("type"))
22089      res.setType(parseCodeableConcept(getJObject(json, "type")));
22090    if (json.has("appliesTo")) {
22091      JsonArray array = json.getAsJsonArray("appliesTo");
22092      for (int i = 0; i < array.size(); i++) {
22093        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22094      }
22095    }
22096    ;
22097    if (json.has("age"))
22098      res.setAge(parseRange(getJObject(json, "age")));
22099    if (json.has("text"))
22100      res.setTextElement(parseString(json.get("text").getAsString()));
22101    if (json.has("_text"))
22102      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
22103  }
22104
22105  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json,
22106      Observation owner) throws IOException, FHIRFormatError {
22107    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
22108    parseObservationObservationComponentComponentProperties(json, owner, res);
22109    return res;
22110  }
22111
22112  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner,
22113      Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
22114    parseBackboneElementProperties(json, res);
22115    if (json.has("code"))
22116      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22117    Type value = parseType("value", json);
22118    if (value != null)
22119      res.setValue(value);
22120    if (json.has("dataAbsentReason"))
22121      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
22122    if (json.has("interpretation")) {
22123      JsonArray array = json.getAsJsonArray("interpretation");
22124      for (int i = 0; i < array.size(); i++) {
22125        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22126      }
22127    }
22128    ;
22129    if (json.has("referenceRange")) {
22130      JsonArray array = json.getAsJsonArray("referenceRange");
22131      for (int i = 0; i < array.size(); i++) {
22132        res.getReferenceRange()
22133            .add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
22134      }
22135    }
22136    ;
22137  }
22138
22139  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
22140    ObservationDefinition res = new ObservationDefinition();
22141    parseObservationDefinitionProperties(json, res);
22142    return res;
22143  }
22144
22145  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res)
22146      throws IOException, FHIRFormatError {
22147    parseDomainResourceProperties(json, res);
22148    if (json.has("category")) {
22149      JsonArray array = json.getAsJsonArray("category");
22150      for (int i = 0; i < array.size(); i++) {
22151        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22152      }
22153    }
22154    ;
22155    if (json.has("code"))
22156      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22157    if (json.has("identifier")) {
22158      JsonArray array = json.getAsJsonArray("identifier");
22159      for (int i = 0; i < array.size(); i++) {
22160        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22161      }
22162    }
22163    ;
22164    if (json.has("permittedDataType")) {
22165      JsonArray array = json.getAsJsonArray("permittedDataType");
22166      for (int i = 0; i < array.size(); i++) {
22167        if (array.get(i).isJsonNull()) {
22168          res.getPermittedDataType().add(new Enumeration<ObservationDefinition.ObservationDataType>());
22169        } else {
22170          res.getPermittedDataType()
22171              .add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL,
22172                  new ObservationDefinition.ObservationDataTypeEnumFactory()));
22173        }
22174      }
22175    }
22176    ;
22177    if (json.has("_permittedDataType")) {
22178      JsonArray array = json.getAsJsonArray("_permittedDataType");
22179      for (int i = 0; i < array.size(); i++) {
22180        if (i == res.getPermittedDataType().size())
22181          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL,
22182              new ObservationDefinition.ObservationDataTypeEnumFactory()));
22183        if (array.get(i) instanceof JsonObject)
22184          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
22185      }
22186    }
22187    ;
22188    if (json.has("multipleResultsAllowed"))
22189      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
22190    if (json.has("_multipleResultsAllowed"))
22191      parseElementProperties(getJObject(json, "_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
22192    if (json.has("method"))
22193      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
22194    if (json.has("preferredReportName"))
22195      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
22196    if (json.has("_preferredReportName"))
22197      parseElementProperties(getJObject(json, "_preferredReportName"), res.getPreferredReportNameElement());
22198    if (json.has("quantitativeDetails"))
22199      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(
22200          getJObject(json, "quantitativeDetails"), res));
22201    if (json.has("qualifiedInterval")) {
22202      JsonArray array = json.getAsJsonArray("qualifiedInterval");
22203      for (int i = 0; i < array.size(); i++) {
22204        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(
22205            array.get(i).getAsJsonObject(), res));
22206      }
22207    }
22208    ;
22209    if (json.has("validCodedValueSet"))
22210      res.setValidCodedValueSet(parseReference(getJObject(json, "validCodedValueSet")));
22211    if (json.has("normalCodedValueSet"))
22212      res.setNormalCodedValueSet(parseReference(getJObject(json, "normalCodedValueSet")));
22213    if (json.has("abnormalCodedValueSet"))
22214      res.setAbnormalCodedValueSet(parseReference(getJObject(json, "abnormalCodedValueSet")));
22215    if (json.has("criticalCodedValueSet"))
22216      res.setCriticalCodedValueSet(parseReference(getJObject(json, "criticalCodedValueSet")));
22217  }
22218
22219  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(
22220      JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
22221    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
22222    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
22223    return res;
22224  }
22225
22226  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json,
22227      ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res)
22228      throws IOException, FHIRFormatError {
22229    parseBackboneElementProperties(json, res);
22230    if (json.has("customaryUnit"))
22231      res.setCustomaryUnit(parseCodeableConcept(getJObject(json, "customaryUnit")));
22232    if (json.has("unit"))
22233      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
22234    if (json.has("conversionFactor"))
22235      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
22236    if (json.has("_conversionFactor"))
22237      parseElementProperties(getJObject(json, "_conversionFactor"), res.getConversionFactorElement());
22238    if (json.has("decimalPrecision"))
22239      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
22240    if (json.has("_decimalPrecision"))
22241      parseElementProperties(getJObject(json, "_decimalPrecision"), res.getDecimalPrecisionElement());
22242  }
22243
22244  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(
22245      JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
22246    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
22247    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
22248    return res;
22249  }
22250
22251  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json,
22252      ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res)
22253      throws IOException, FHIRFormatError {
22254    parseBackboneElementProperties(json, res);
22255    if (json.has("category"))
22256      res.setCategoryElement(
22257          parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL,
22258              new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
22259    if (json.has("_category"))
22260      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
22261    if (json.has("range"))
22262      res.setRange(parseRange(getJObject(json, "range")));
22263    if (json.has("context"))
22264      res.setContext(parseCodeableConcept(getJObject(json, "context")));
22265    if (json.has("appliesTo")) {
22266      JsonArray array = json.getAsJsonArray("appliesTo");
22267      for (int i = 0; i < array.size(); i++) {
22268        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22269      }
22270    }
22271    ;
22272    if (json.has("gender"))
22273      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL,
22274          new Enumerations.AdministrativeGenderEnumFactory()));
22275    if (json.has("_gender"))
22276      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
22277    if (json.has("age"))
22278      res.setAge(parseRange(getJObject(json, "age")));
22279    if (json.has("gestationalAge"))
22280      res.setGestationalAge(parseRange(getJObject(json, "gestationalAge")));
22281    if (json.has("condition"))
22282      res.setConditionElement(parseString(json.get("condition").getAsString()));
22283    if (json.has("_condition"))
22284      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
22285  }
22286
22287  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
22288    OperationDefinition res = new OperationDefinition();
22289    parseOperationDefinitionProperties(json, res);
22290    return res;
22291  }
22292
22293  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res)
22294      throws IOException, FHIRFormatError {
22295    parseDomainResourceProperties(json, res);
22296    if (json.has("url"))
22297      res.setUrlElement(parseUri(json.get("url").getAsString()));
22298    if (json.has("_url"))
22299      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
22300    if (json.has("version"))
22301      res.setVersionElement(parseString(json.get("version").getAsString()));
22302    if (json.has("_version"))
22303      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22304    if (json.has("name"))
22305      res.setNameElement(parseString(json.get("name").getAsString()));
22306    if (json.has("_name"))
22307      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22308    if (json.has("title"))
22309      res.setTitleElement(parseString(json.get("title").getAsString()));
22310    if (json.has("_title"))
22311      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22312    if (json.has("status"))
22313      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
22314          new Enumerations.PublicationStatusEnumFactory()));
22315    if (json.has("_status"))
22316      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22317    if (json.has("kind"))
22318      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL,
22319          new OperationDefinition.OperationKindEnumFactory()));
22320    if (json.has("_kind"))
22321      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
22322    if (json.has("experimental"))
22323      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22324    if (json.has("_experimental"))
22325      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
22326    if (json.has("date"))
22327      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22328    if (json.has("_date"))
22329      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
22330    if (json.has("publisher"))
22331      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22332    if (json.has("_publisher"))
22333      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
22334    if (json.has("contact")) {
22335      JsonArray array = json.getAsJsonArray("contact");
22336      for (int i = 0; i < array.size(); i++) {
22337        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22338      }
22339    }
22340    ;
22341    if (json.has("description"))
22342      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22343    if (json.has("_description"))
22344      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22345    if (json.has("useContext")) {
22346      JsonArray array = json.getAsJsonArray("useContext");
22347      for (int i = 0; i < array.size(); i++) {
22348        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22349      }
22350    }
22351    ;
22352    if (json.has("jurisdiction")) {
22353      JsonArray array = json.getAsJsonArray("jurisdiction");
22354      for (int i = 0; i < array.size(); i++) {
22355        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22356      }
22357    }
22358    ;
22359    if (json.has("purpose"))
22360      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22361    if (json.has("_purpose"))
22362      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
22363    if (json.has("affectsState"))
22364      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
22365    if (json.has("_affectsState"))
22366      parseElementProperties(getJObject(json, "_affectsState"), res.getAffectsStateElement());
22367    if (json.has("code"))
22368      res.setCodeElement(parseCode(json.get("code").getAsString()));
22369    if (json.has("_code"))
22370      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
22371    if (json.has("comment"))
22372      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
22373    if (json.has("_comment"))
22374      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
22375    if (json.has("base"))
22376      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
22377    if (json.has("_base"))
22378      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
22379    if (json.has("resource")) {
22380      JsonArray array = json.getAsJsonArray("resource");
22381      for (int i = 0; i < array.size(); i++) {
22382        if (array.get(i).isJsonNull()) {
22383          res.getResource().add(new CodeType());
22384        } else {
22385          res.getResource().add(parseCode(array.get(i).getAsString()));
22386        }
22387      }
22388    }
22389    ;
22390    if (json.has("_resource")) {
22391      JsonArray array = json.getAsJsonArray("_resource");
22392      for (int i = 0; i < array.size(); i++) {
22393        if (i == res.getResource().size())
22394          res.getResource().add(parseCode(null));
22395        if (array.get(i) instanceof JsonObject)
22396          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
22397      }
22398    }
22399    ;
22400    if (json.has("system"))
22401      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
22402    if (json.has("_system"))
22403      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
22404    if (json.has("type"))
22405      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
22406    if (json.has("_type"))
22407      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
22408    if (json.has("instance"))
22409      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
22410    if (json.has("_instance"))
22411      parseElementProperties(getJObject(json, "_instance"), res.getInstanceElement());
22412    if (json.has("inputProfile"))
22413      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
22414    if (json.has("_inputProfile"))
22415      parseElementProperties(getJObject(json, "_inputProfile"), res.getInputProfileElement());
22416    if (json.has("outputProfile"))
22417      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
22418    if (json.has("_outputProfile"))
22419      parseElementProperties(getJObject(json, "_outputProfile"), res.getOutputProfileElement());
22420    if (json.has("parameter")) {
22421      JsonArray array = json.getAsJsonArray("parameter");
22422      for (int i = 0; i < array.size(); i++) {
22423        res.getParameter()
22424            .add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
22425      }
22426    }
22427    ;
22428    if (json.has("overload")) {
22429      JsonArray array = json.getAsJsonArray("overload");
22430      for (int i = 0; i < array.size(); i++) {
22431        res.getOverload()
22432            .add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
22433      }
22434    }
22435    ;
22436  }
22437
22438  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(
22439      JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
22440    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
22441    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
22442    return res;
22443  }
22444
22445  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json,
22446      OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res)
22447      throws IOException, FHIRFormatError {
22448    parseBackboneElementProperties(json, res);
22449    if (json.has("name"))
22450      res.setNameElement(parseCode(json.get("name").getAsString()));
22451    if (json.has("_name"))
22452      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22453    if (json.has("use"))
22454      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL,
22455          new OperationDefinition.OperationParameterUseEnumFactory()));
22456    if (json.has("_use"))
22457      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
22458    if (json.has("min"))
22459      res.setMinElement(parseInteger(json.get("min").getAsLong()));
22460    if (json.has("_min"))
22461      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
22462    if (json.has("max"))
22463      res.setMaxElement(parseString(json.get("max").getAsString()));
22464    if (json.has("_max"))
22465      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
22466    if (json.has("documentation"))
22467      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
22468    if (json.has("_documentation"))
22469      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
22470    if (json.has("type"))
22471      res.setTypeElement(parseCode(json.get("type").getAsString()));
22472    if (json.has("_type"))
22473      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
22474    if (json.has("targetProfile")) {
22475      JsonArray array = json.getAsJsonArray("targetProfile");
22476      for (int i = 0; i < array.size(); i++) {
22477        if (array.get(i).isJsonNull()) {
22478          res.getTargetProfile().add(new CanonicalType());
22479        } else {
22480          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
22481        }
22482      }
22483    }
22484    ;
22485    if (json.has("_targetProfile")) {
22486      JsonArray array = json.getAsJsonArray("_targetProfile");
22487      for (int i = 0; i < array.size(); i++) {
22488        if (i == res.getTargetProfile().size())
22489          res.getTargetProfile().add(parseCanonical(null));
22490        if (array.get(i) instanceof JsonObject)
22491          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
22492      }
22493    }
22494    ;
22495    if (json.has("searchType"))
22496      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL,
22497          new Enumerations.SearchParamTypeEnumFactory()));
22498    if (json.has("_searchType"))
22499      parseElementProperties(getJObject(json, "_searchType"), res.getSearchTypeElement());
22500    if (json.has("binding"))
22501      res.setBinding(
22502          parseOperationDefinitionOperationDefinitionParameterBindingComponent(getJObject(json, "binding"), owner));
22503    if (json.has("referencedFrom")) {
22504      JsonArray array = json.getAsJsonArray("referencedFrom");
22505      for (int i = 0; i < array.size(); i++) {
22506        res.getReferencedFrom().add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(
22507            array.get(i).getAsJsonObject(), owner));
22508      }
22509    }
22510    ;
22511    if (json.has("part")) {
22512      JsonArray array = json.getAsJsonArray("part");
22513      for (int i = 0; i < array.size(); i++) {
22514        res.getPart()
22515            .add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
22516      }
22517    }
22518    ;
22519  }
22520
22521  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(
22522      JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
22523    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
22524    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
22525    return res;
22526  }
22527
22528  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json,
22529      OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res)
22530      throws IOException, FHIRFormatError {
22531    parseBackboneElementProperties(json, res);
22532    if (json.has("strength"))
22533      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL,
22534          new Enumerations.BindingStrengthEnumFactory()));
22535    if (json.has("_strength"))
22536      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
22537    if (json.has("valueSet"))
22538      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
22539    if (json.has("_valueSet"))
22540      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
22541  }
22542
22543  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(
22544      JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
22545    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
22546    parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(json, owner, res);
22547    return res;
22548  }
22549
22550  protected void parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json,
22551      OperationDefinition owner, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res)
22552      throws IOException, FHIRFormatError {
22553    parseBackboneElementProperties(json, res);
22554    if (json.has("source"))
22555      res.setSourceElement(parseString(json.get("source").getAsString()));
22556    if (json.has("_source"))
22557      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
22558    if (json.has("sourceId"))
22559      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
22560    if (json.has("_sourceId"))
22561      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
22562  }
22563
22564  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(
22565      JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
22566    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
22567    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
22568    return res;
22569  }
22570
22571  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json,
22572      OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res)
22573      throws IOException, FHIRFormatError {
22574    parseBackboneElementProperties(json, res);
22575    if (json.has("parameterName")) {
22576      JsonArray array = json.getAsJsonArray("parameterName");
22577      for (int i = 0; i < array.size(); i++) {
22578        if (array.get(i).isJsonNull()) {
22579          res.getParameterName().add(new StringType());
22580        } else {
22581          res.getParameterName().add(parseString(array.get(i).getAsString()));
22582        }
22583      }
22584    }
22585    ;
22586    if (json.has("_parameterName")) {
22587      JsonArray array = json.getAsJsonArray("_parameterName");
22588      for (int i = 0; i < array.size(); i++) {
22589        if (i == res.getParameterName().size())
22590          res.getParameterName().add(parseString(null));
22591        if (array.get(i) instanceof JsonObject)
22592          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
22593      }
22594    }
22595    ;
22596    if (json.has("comment"))
22597      res.setCommentElement(parseString(json.get("comment").getAsString()));
22598    if (json.has("_comment"))
22599      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
22600  }
22601
22602  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
22603    OperationOutcome res = new OperationOutcome();
22604    parseOperationOutcomeProperties(json, res);
22605    return res;
22606  }
22607
22608  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res)
22609      throws IOException, FHIRFormatError {
22610    parseDomainResourceProperties(json, res);
22611    if (json.has("issue")) {
22612      JsonArray array = json.getAsJsonArray("issue");
22613      for (int i = 0; i < array.size(); i++) {
22614        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
22615      }
22616    }
22617    ;
22618  }
22619
22620  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(
22621      JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
22622    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
22623    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
22624    return res;
22625  }
22626
22627  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner,
22628      OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
22629    parseBackboneElementProperties(json, res);
22630    if (json.has("severity"))
22631      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL,
22632          new OperationOutcome.IssueSeverityEnumFactory()));
22633    if (json.has("_severity"))
22634      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
22635    if (json.has("code"))
22636      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL,
22637          new OperationOutcome.IssueTypeEnumFactory()));
22638    if (json.has("_code"))
22639      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
22640    if (json.has("details"))
22641      res.setDetails(parseCodeableConcept(getJObject(json, "details")));
22642    if (json.has("diagnostics"))
22643      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
22644    if (json.has("_diagnostics"))
22645      parseElementProperties(getJObject(json, "_diagnostics"), res.getDiagnosticsElement());
22646    if (json.has("location")) {
22647      JsonArray array = json.getAsJsonArray("location");
22648      for (int i = 0; i < array.size(); i++) {
22649        if (array.get(i).isJsonNull()) {
22650          res.getLocation().add(new StringType());
22651        } else {
22652          res.getLocation().add(parseString(array.get(i).getAsString()));
22653        }
22654      }
22655    }
22656    ;
22657    if (json.has("_location")) {
22658      JsonArray array = json.getAsJsonArray("_location");
22659      for (int i = 0; i < array.size(); i++) {
22660        if (i == res.getLocation().size())
22661          res.getLocation().add(parseString(null));
22662        if (array.get(i) instanceof JsonObject)
22663          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
22664      }
22665    }
22666    ;
22667    if (json.has("expression")) {
22668      JsonArray array = json.getAsJsonArray("expression");
22669      for (int i = 0; i < array.size(); i++) {
22670        if (array.get(i).isJsonNull()) {
22671          res.getExpression().add(new StringType());
22672        } else {
22673          res.getExpression().add(parseString(array.get(i).getAsString()));
22674        }
22675      }
22676    }
22677    ;
22678    if (json.has("_expression")) {
22679      JsonArray array = json.getAsJsonArray("_expression");
22680      for (int i = 0; i < array.size(); i++) {
22681        if (i == res.getExpression().size())
22682          res.getExpression().add(parseString(null));
22683        if (array.get(i) instanceof JsonObject)
22684          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
22685      }
22686    }
22687    ;
22688  }
22689
22690  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
22691    Organization res = new Organization();
22692    parseOrganizationProperties(json, res);
22693    return res;
22694  }
22695
22696  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
22697    parseDomainResourceProperties(json, res);
22698    if (json.has("identifier")) {
22699      JsonArray array = json.getAsJsonArray("identifier");
22700      for (int i = 0; i < array.size(); i++) {
22701        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22702      }
22703    }
22704    ;
22705    if (json.has("active"))
22706      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22707    if (json.has("_active"))
22708      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
22709    if (json.has("type")) {
22710      JsonArray array = json.getAsJsonArray("type");
22711      for (int i = 0; i < array.size(); i++) {
22712        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22713      }
22714    }
22715    ;
22716    if (json.has("name"))
22717      res.setNameElement(parseString(json.get("name").getAsString()));
22718    if (json.has("_name"))
22719      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22720    if (json.has("alias")) {
22721      JsonArray array = json.getAsJsonArray("alias");
22722      for (int i = 0; i < array.size(); i++) {
22723        if (array.get(i).isJsonNull()) {
22724          res.getAlias().add(new StringType());
22725        } else {
22726          res.getAlias().add(parseString(array.get(i).getAsString()));
22727        }
22728      }
22729    }
22730    ;
22731    if (json.has("_alias")) {
22732      JsonArray array = json.getAsJsonArray("_alias");
22733      for (int i = 0; i < array.size(); i++) {
22734        if (i == res.getAlias().size())
22735          res.getAlias().add(parseString(null));
22736        if (array.get(i) instanceof JsonObject)
22737          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
22738      }
22739    }
22740    ;
22741    if (json.has("telecom")) {
22742      JsonArray array = json.getAsJsonArray("telecom");
22743      for (int i = 0; i < array.size(); i++) {
22744        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22745      }
22746    }
22747    ;
22748    if (json.has("address")) {
22749      JsonArray array = json.getAsJsonArray("address");
22750      for (int i = 0; i < array.size(); i++) {
22751        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
22752      }
22753    }
22754    ;
22755    if (json.has("partOf"))
22756      res.setPartOf(parseReference(getJObject(json, "partOf")));
22757    if (json.has("contact")) {
22758      JsonArray array = json.getAsJsonArray("contact");
22759      for (int i = 0; i < array.size(); i++) {
22760        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
22761      }
22762    }
22763    ;
22764    if (json.has("endpoint")) {
22765      JsonArray array = json.getAsJsonArray("endpoint");
22766      for (int i = 0; i < array.size(); i++) {
22767        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
22768      }
22769    }
22770    ;
22771  }
22772
22773  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json,
22774      Organization owner) throws IOException, FHIRFormatError {
22775    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
22776    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
22777    return res;
22778  }
22779
22780  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner,
22781      Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
22782    parseBackboneElementProperties(json, res);
22783    if (json.has("purpose"))
22784      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
22785    if (json.has("name"))
22786      res.setName(parseHumanName(getJObject(json, "name")));
22787    if (json.has("telecom")) {
22788      JsonArray array = json.getAsJsonArray("telecom");
22789      for (int i = 0; i < array.size(); i++) {
22790        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22791      }
22792    }
22793    ;
22794    if (json.has("address"))
22795      res.setAddress(parseAddress(getJObject(json, "address")));
22796  }
22797
22798  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
22799    OrganizationAffiliation res = new OrganizationAffiliation();
22800    parseOrganizationAffiliationProperties(json, res);
22801    return res;
22802  }
22803
22804  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res)
22805      throws IOException, FHIRFormatError {
22806    parseDomainResourceProperties(json, res);
22807    if (json.has("identifier")) {
22808      JsonArray array = json.getAsJsonArray("identifier");
22809      for (int i = 0; i < array.size(); i++) {
22810        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22811      }
22812    }
22813    ;
22814    if (json.has("active"))
22815      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22816    if (json.has("_active"))
22817      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
22818    if (json.has("period"))
22819      res.setPeriod(parsePeriod(getJObject(json, "period")));
22820    if (json.has("organization"))
22821      res.setOrganization(parseReference(getJObject(json, "organization")));
22822    if (json.has("participatingOrganization"))
22823      res.setParticipatingOrganization(parseReference(getJObject(json, "participatingOrganization")));
22824    if (json.has("network")) {
22825      JsonArray array = json.getAsJsonArray("network");
22826      for (int i = 0; i < array.size(); i++) {
22827        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
22828      }
22829    }
22830    ;
22831    if (json.has("code")) {
22832      JsonArray array = json.getAsJsonArray("code");
22833      for (int i = 0; i < array.size(); i++) {
22834        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22835      }
22836    }
22837    ;
22838    if (json.has("specialty")) {
22839      JsonArray array = json.getAsJsonArray("specialty");
22840      for (int i = 0; i < array.size(); i++) {
22841        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22842      }
22843    }
22844    ;
22845    if (json.has("location")) {
22846      JsonArray array = json.getAsJsonArray("location");
22847      for (int i = 0; i < array.size(); i++) {
22848        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
22849      }
22850    }
22851    ;
22852    if (json.has("healthcareService")) {
22853      JsonArray array = json.getAsJsonArray("healthcareService");
22854      for (int i = 0; i < array.size(); i++) {
22855        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
22856      }
22857    }
22858    ;
22859    if (json.has("telecom")) {
22860      JsonArray array = json.getAsJsonArray("telecom");
22861      for (int i = 0; i < array.size(); i++) {
22862        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22863      }
22864    }
22865    ;
22866    if (json.has("endpoint")) {
22867      JsonArray array = json.getAsJsonArray("endpoint");
22868      for (int i = 0; i < array.size(); i++) {
22869        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
22870      }
22871    }
22872    ;
22873  }
22874
22875  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
22876    Patient res = new Patient();
22877    parsePatientProperties(json, res);
22878    return res;
22879  }
22880
22881  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
22882    parseDomainResourceProperties(json, res);
22883    if (json.has("identifier")) {
22884      JsonArray array = json.getAsJsonArray("identifier");
22885      for (int i = 0; i < array.size(); i++) {
22886        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22887      }
22888    }
22889    ;
22890    if (json.has("active"))
22891      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22892    if (json.has("_active"))
22893      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
22894    if (json.has("name")) {
22895      JsonArray array = json.getAsJsonArray("name");
22896      for (int i = 0; i < array.size(); i++) {
22897        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
22898      }
22899    }
22900    ;
22901    if (json.has("telecom")) {
22902      JsonArray array = json.getAsJsonArray("telecom");
22903      for (int i = 0; i < array.size(); i++) {
22904        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22905      }
22906    }
22907    ;
22908    if (json.has("gender"))
22909      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL,
22910          new Enumerations.AdministrativeGenderEnumFactory()));
22911    if (json.has("_gender"))
22912      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
22913    if (json.has("birthDate"))
22914      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
22915    if (json.has("_birthDate"))
22916      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
22917    Type deceased = parseType("deceased", json);
22918    if (deceased != null)
22919      res.setDeceased(deceased);
22920    if (json.has("address")) {
22921      JsonArray array = json.getAsJsonArray("address");
22922      for (int i = 0; i < array.size(); i++) {
22923        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
22924      }
22925    }
22926    ;
22927    if (json.has("maritalStatus"))
22928      res.setMaritalStatus(parseCodeableConcept(getJObject(json, "maritalStatus")));
22929    Type multipleBirth = parseType("multipleBirth", json);
22930    if (multipleBirth != null)
22931      res.setMultipleBirth(multipleBirth);
22932    if (json.has("photo")) {
22933      JsonArray array = json.getAsJsonArray("photo");
22934      for (int i = 0; i < array.size(); i++) {
22935        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
22936      }
22937    }
22938    ;
22939    if (json.has("contact")) {
22940      JsonArray array = json.getAsJsonArray("contact");
22941      for (int i = 0; i < array.size(); i++) {
22942        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
22943      }
22944    }
22945    ;
22946    if (json.has("communication")) {
22947      JsonArray array = json.getAsJsonArray("communication");
22948      for (int i = 0; i < array.size(); i++) {
22949        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
22950      }
22951    }
22952    ;
22953    if (json.has("generalPractitioner")) {
22954      JsonArray array = json.getAsJsonArray("generalPractitioner");
22955      for (int i = 0; i < array.size(); i++) {
22956        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
22957      }
22958    }
22959    ;
22960    if (json.has("managingOrganization"))
22961      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
22962    if (json.has("link")) {
22963      JsonArray array = json.getAsJsonArray("link");
22964      for (int i = 0; i < array.size(); i++) {
22965        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
22966      }
22967    }
22968    ;
22969  }
22970
22971  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner)
22972      throws IOException, FHIRFormatError {
22973    Patient.ContactComponent res = new Patient.ContactComponent();
22974    parsePatientContactComponentProperties(json, owner, res);
22975    return res;
22976  }
22977
22978  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res)
22979      throws IOException, FHIRFormatError {
22980    parseBackboneElementProperties(json, res);
22981    if (json.has("relationship")) {
22982      JsonArray array = json.getAsJsonArray("relationship");
22983      for (int i = 0; i < array.size(); i++) {
22984        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22985      }
22986    }
22987    ;
22988    if (json.has("name"))
22989      res.setName(parseHumanName(getJObject(json, "name")));
22990    if (json.has("telecom")) {
22991      JsonArray array = json.getAsJsonArray("telecom");
22992      for (int i = 0; i < array.size(); i++) {
22993        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22994      }
22995    }
22996    ;
22997    if (json.has("address"))
22998      res.setAddress(parseAddress(getJObject(json, "address")));
22999    if (json.has("gender"))
23000      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL,
23001          new Enumerations.AdministrativeGenderEnumFactory()));
23002    if (json.has("_gender"))
23003      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
23004    if (json.has("organization"))
23005      res.setOrganization(parseReference(getJObject(json, "organization")));
23006    if (json.has("period"))
23007      res.setPeriod(parsePeriod(getJObject(json, "period")));
23008  }
23009
23010  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json,
23011      Patient owner) throws IOException, FHIRFormatError {
23012    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
23013    parsePatientPatientCommunicationComponentProperties(json, owner, res);
23014    return res;
23015  }
23016
23017  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner,
23018      Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
23019    parseBackboneElementProperties(json, res);
23020    if (json.has("language"))
23021      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
23022    if (json.has("preferred"))
23023      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
23024    if (json.has("_preferred"))
23025      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
23026  }
23027
23028  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner)
23029      throws IOException, FHIRFormatError {
23030    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
23031    parsePatientPatientLinkComponentProperties(json, owner, res);
23032    return res;
23033  }
23034
23035  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner,
23036      Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
23037    parseBackboneElementProperties(json, res);
23038    if (json.has("other"))
23039      res.setOther(parseReference(getJObject(json, "other")));
23040    if (json.has("type"))
23041      res.setTypeElement(
23042          parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
23043    if (json.has("_type"))
23044      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23045  }
23046
23047  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
23048    PaymentNotice res = new PaymentNotice();
23049    parsePaymentNoticeProperties(json, res);
23050    return res;
23051  }
23052
23053  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
23054    parseDomainResourceProperties(json, res);
23055    if (json.has("identifier")) {
23056      JsonArray array = json.getAsJsonArray("identifier");
23057      for (int i = 0; i < array.size(); i++) {
23058        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23059      }
23060    }
23061    ;
23062    if (json.has("status"))
23063      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL,
23064          new PaymentNotice.PaymentNoticeStatusEnumFactory()));
23065    if (json.has("_status"))
23066      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23067    if (json.has("request"))
23068      res.setRequest(parseReference(getJObject(json, "request")));
23069    if (json.has("response"))
23070      res.setResponse(parseReference(getJObject(json, "response")));
23071    if (json.has("created"))
23072      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
23073    if (json.has("_created"))
23074      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
23075    if (json.has("provider"))
23076      res.setProvider(parseReference(getJObject(json, "provider")));
23077    if (json.has("payment"))
23078      res.setPayment(parseReference(getJObject(json, "payment")));
23079    if (json.has("paymentDate"))
23080      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
23081    if (json.has("_paymentDate"))
23082      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
23083    if (json.has("payee"))
23084      res.setPayee(parseReference(getJObject(json, "payee")));
23085    if (json.has("recipient"))
23086      res.setRecipient(parseReference(getJObject(json, "recipient")));
23087    if (json.has("amount"))
23088      res.setAmount(parseMoney(getJObject(json, "amount")));
23089    if (json.has("paymentStatus"))
23090      res.setPaymentStatus(parseCodeableConcept(getJObject(json, "paymentStatus")));
23091  }
23092
23093  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
23094    PaymentReconciliation res = new PaymentReconciliation();
23095    parsePaymentReconciliationProperties(json, res);
23096    return res;
23097  }
23098
23099  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res)
23100      throws IOException, FHIRFormatError {
23101    parseDomainResourceProperties(json, res);
23102    if (json.has("identifier")) {
23103      JsonArray array = json.getAsJsonArray("identifier");
23104      for (int i = 0; i < array.size(); i++) {
23105        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23106      }
23107    }
23108    ;
23109    if (json.has("status"))
23110      res.setStatusElement(
23111          parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL,
23112              new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
23113    if (json.has("_status"))
23114      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23115    if (json.has("period"))
23116      res.setPeriod(parsePeriod(getJObject(json, "period")));
23117    if (json.has("created"))
23118      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
23119    if (json.has("_created"))
23120      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
23121    if (json.has("paymentIssuer"))
23122      res.setPaymentIssuer(parseReference(getJObject(json, "paymentIssuer")));
23123    if (json.has("request"))
23124      res.setRequest(parseReference(getJObject(json, "request")));
23125    if (json.has("requestor"))
23126      res.setRequestor(parseReference(getJObject(json, "requestor")));
23127    if (json.has("outcome"))
23128      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL,
23129          new Enumerations.RemittanceOutcomeEnumFactory()));
23130    if (json.has("_outcome"))
23131      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
23132    if (json.has("disposition"))
23133      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
23134    if (json.has("_disposition"))
23135      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
23136    if (json.has("paymentDate"))
23137      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
23138    if (json.has("_paymentDate"))
23139      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
23140    if (json.has("paymentAmount"))
23141      res.setPaymentAmount(parseMoney(getJObject(json, "paymentAmount")));
23142    if (json.has("paymentIdentifier"))
23143      res.setPaymentIdentifier(parseIdentifier(getJObject(json, "paymentIdentifier")));
23144    if (json.has("detail")) {
23145      JsonArray array = json.getAsJsonArray("detail");
23146      for (int i = 0; i < array.size(); i++) {
23147        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
23148      }
23149    }
23150    ;
23151    if (json.has("formCode"))
23152      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
23153    if (json.has("processNote")) {
23154      JsonArray array = json.getAsJsonArray("processNote");
23155      for (int i = 0; i < array.size(); i++) {
23156        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
23157      }
23158    }
23159    ;
23160  }
23161
23162  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json,
23163      PaymentReconciliation owner) throws IOException, FHIRFormatError {
23164    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
23165    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
23166    return res;
23167  }
23168
23169  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner,
23170      PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
23171    parseBackboneElementProperties(json, res);
23172    if (json.has("identifier"))
23173      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
23174    if (json.has("predecessor"))
23175      res.setPredecessor(parseIdentifier(getJObject(json, "predecessor")));
23176    if (json.has("type"))
23177      res.setType(parseCodeableConcept(getJObject(json, "type")));
23178    if (json.has("request"))
23179      res.setRequest(parseReference(getJObject(json, "request")));
23180    if (json.has("submitter"))
23181      res.setSubmitter(parseReference(getJObject(json, "submitter")));
23182    if (json.has("response"))
23183      res.setResponse(parseReference(getJObject(json, "response")));
23184    if (json.has("date"))
23185      res.setDateElement(parseDate(json.get("date").getAsString()));
23186    if (json.has("_date"))
23187      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23188    if (json.has("responsible"))
23189      res.setResponsible(parseReference(getJObject(json, "responsible")));
23190    if (json.has("payee"))
23191      res.setPayee(parseReference(getJObject(json, "payee")));
23192    if (json.has("amount"))
23193      res.setAmount(parseMoney(getJObject(json, "amount")));
23194  }
23195
23196  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json,
23197      PaymentReconciliation owner) throws IOException, FHIRFormatError {
23198    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
23199    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
23200    return res;
23201  }
23202
23203  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner,
23204      PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
23205    parseBackboneElementProperties(json, res);
23206    if (json.has("type"))
23207      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL,
23208          new Enumerations.NoteTypeEnumFactory()));
23209    if (json.has("_type"))
23210      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23211    if (json.has("text"))
23212      res.setTextElement(parseString(json.get("text").getAsString()));
23213    if (json.has("_text"))
23214      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
23215  }
23216
23217  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
23218    Person res = new Person();
23219    parsePersonProperties(json, res);
23220    return res;
23221  }
23222
23223  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
23224    parseDomainResourceProperties(json, res);
23225    if (json.has("identifier")) {
23226      JsonArray array = json.getAsJsonArray("identifier");
23227      for (int i = 0; i < array.size(); i++) {
23228        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23229      }
23230    }
23231    ;
23232    if (json.has("name")) {
23233      JsonArray array = json.getAsJsonArray("name");
23234      for (int i = 0; i < array.size(); i++) {
23235        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
23236      }
23237    }
23238    ;
23239    if (json.has("telecom")) {
23240      JsonArray array = json.getAsJsonArray("telecom");
23241      for (int i = 0; i < array.size(); i++) {
23242        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
23243      }
23244    }
23245    ;
23246    if (json.has("gender"))
23247      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL,
23248          new Enumerations.AdministrativeGenderEnumFactory()));
23249    if (json.has("_gender"))
23250      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
23251    if (json.has("birthDate"))
23252      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
23253    if (json.has("_birthDate"))
23254      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
23255    if (json.has("address")) {
23256      JsonArray array = json.getAsJsonArray("address");
23257      for (int i = 0; i < array.size(); i++) {
23258        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
23259      }
23260    }
23261    ;
23262    if (json.has("photo"))
23263      res.setPhoto(parseAttachment(getJObject(json, "photo")));
23264    if (json.has("managingOrganization"))
23265      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
23266    if (json.has("active"))
23267      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23268    if (json.has("_active"))
23269      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
23270    if (json.has("link")) {
23271      JsonArray array = json.getAsJsonArray("link");
23272      for (int i = 0; i < array.size(); i++) {
23273        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
23274      }
23275    }
23276    ;
23277  }
23278
23279  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner)
23280      throws IOException, FHIRFormatError {
23281    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
23282    parsePersonPersonLinkComponentProperties(json, owner, res);
23283    return res;
23284  }
23285
23286  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res)
23287      throws IOException, FHIRFormatError {
23288    parseBackboneElementProperties(json, res);
23289    if (json.has("target"))
23290      res.setTarget(parseReference(getJObject(json, "target")));
23291    if (json.has("assurance"))
23292      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL,
23293          new Person.IdentityAssuranceLevelEnumFactory()));
23294    if (json.has("_assurance"))
23295      parseElementProperties(getJObject(json, "_assurance"), res.getAssuranceElement());
23296  }
23297
23298  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
23299    PlanDefinition res = new PlanDefinition();
23300    parsePlanDefinitionProperties(json, res);
23301    return res;
23302  }
23303
23304  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res)
23305      throws IOException, FHIRFormatError {
23306    parseDomainResourceProperties(json, res);
23307    if (json.has("url"))
23308      res.setUrlElement(parseUri(json.get("url").getAsString()));
23309    if (json.has("_url"))
23310      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23311    if (json.has("identifier")) {
23312      JsonArray array = json.getAsJsonArray("identifier");
23313      for (int i = 0; i < array.size(); i++) {
23314        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23315      }
23316    }
23317    ;
23318    if (json.has("version"))
23319      res.setVersionElement(parseString(json.get("version").getAsString()));
23320    if (json.has("_version"))
23321      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23322    if (json.has("name"))
23323      res.setNameElement(parseString(json.get("name").getAsString()));
23324    if (json.has("_name"))
23325      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23326    if (json.has("title"))
23327      res.setTitleElement(parseString(json.get("title").getAsString()));
23328    if (json.has("_title"))
23329      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23330    if (json.has("subtitle"))
23331      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
23332    if (json.has("_subtitle"))
23333      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
23334    if (json.has("type"))
23335      res.setType(parseCodeableConcept(getJObject(json, "type")));
23336    if (json.has("status"))
23337      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
23338          new Enumerations.PublicationStatusEnumFactory()));
23339    if (json.has("_status"))
23340      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23341    if (json.has("experimental"))
23342      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23343    if (json.has("_experimental"))
23344      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
23345    Type subject = parseType("subject", json);
23346    if (subject != null)
23347      res.setSubject(subject);
23348    if (json.has("date"))
23349      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23350    if (json.has("_date"))
23351      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23352    if (json.has("publisher"))
23353      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23354    if (json.has("_publisher"))
23355      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23356    if (json.has("contact")) {
23357      JsonArray array = json.getAsJsonArray("contact");
23358      for (int i = 0; i < array.size(); i++) {
23359        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23360      }
23361    }
23362    ;
23363    if (json.has("description"))
23364      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23365    if (json.has("_description"))
23366      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23367    if (json.has("useContext")) {
23368      JsonArray array = json.getAsJsonArray("useContext");
23369      for (int i = 0; i < array.size(); i++) {
23370        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23371      }
23372    }
23373    ;
23374    if (json.has("jurisdiction")) {
23375      JsonArray array = json.getAsJsonArray("jurisdiction");
23376      for (int i = 0; i < array.size(); i++) {
23377        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23378      }
23379    }
23380    ;
23381    if (json.has("purpose"))
23382      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23383    if (json.has("_purpose"))
23384      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
23385    if (json.has("usage"))
23386      res.setUsageElement(parseString(json.get("usage").getAsString()));
23387    if (json.has("_usage"))
23388      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
23389    if (json.has("copyright"))
23390      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23391    if (json.has("_copyright"))
23392      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
23393    if (json.has("approvalDate"))
23394      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
23395    if (json.has("_approvalDate"))
23396      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
23397    if (json.has("lastReviewDate"))
23398      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
23399    if (json.has("_lastReviewDate"))
23400      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
23401    if (json.has("effectivePeriod"))
23402      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
23403    if (json.has("topic")) {
23404      JsonArray array = json.getAsJsonArray("topic");
23405      for (int i = 0; i < array.size(); i++) {
23406        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23407      }
23408    }
23409    ;
23410    if (json.has("author")) {
23411      JsonArray array = json.getAsJsonArray("author");
23412      for (int i = 0; i < array.size(); i++) {
23413        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23414      }
23415    }
23416    ;
23417    if (json.has("editor")) {
23418      JsonArray array = json.getAsJsonArray("editor");
23419      for (int i = 0; i < array.size(); i++) {
23420        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23421      }
23422    }
23423    ;
23424    if (json.has("reviewer")) {
23425      JsonArray array = json.getAsJsonArray("reviewer");
23426      for (int i = 0; i < array.size(); i++) {
23427        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
23428      }
23429    }
23430    ;
23431    if (json.has("endorser")) {
23432      JsonArray array = json.getAsJsonArray("endorser");
23433      for (int i = 0; i < array.size(); i++) {
23434        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
23435      }
23436    }
23437    ;
23438    if (json.has("relatedArtifact")) {
23439      JsonArray array = json.getAsJsonArray("relatedArtifact");
23440      for (int i = 0; i < array.size(); i++) {
23441        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23442      }
23443    }
23444    ;
23445    if (json.has("library")) {
23446      JsonArray array = json.getAsJsonArray("library");
23447      for (int i = 0; i < array.size(); i++) {
23448        if (array.get(i).isJsonNull()) {
23449          res.getLibrary().add(new CanonicalType());
23450        } else {
23451          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
23452        }
23453      }
23454    }
23455    ;
23456    if (json.has("_library")) {
23457      JsonArray array = json.getAsJsonArray("_library");
23458      for (int i = 0; i < array.size(); i++) {
23459        if (i == res.getLibrary().size())
23460          res.getLibrary().add(parseCanonical(null));
23461        if (array.get(i) instanceof JsonObject)
23462          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
23463      }
23464    }
23465    ;
23466    if (json.has("goal")) {
23467      JsonArray array = json.getAsJsonArray("goal");
23468      for (int i = 0; i < array.size(); i++) {
23469        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
23470      }
23471    }
23472    ;
23473    if (json.has("action")) {
23474      JsonArray array = json.getAsJsonArray("action");
23475      for (int i = 0; i < array.size(); i++) {
23476        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
23477      }
23478    }
23479    ;
23480  }
23481
23482  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json,
23483      PlanDefinition owner) throws IOException, FHIRFormatError {
23484    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
23485    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
23486    return res;
23487  }
23488
23489  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner,
23490      PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
23491    parseBackboneElementProperties(json, res);
23492    if (json.has("category"))
23493      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
23494    if (json.has("description"))
23495      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
23496    if (json.has("priority"))
23497      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
23498    if (json.has("start"))
23499      res.setStart(parseCodeableConcept(getJObject(json, "start")));
23500    if (json.has("addresses")) {
23501      JsonArray array = json.getAsJsonArray("addresses");
23502      for (int i = 0; i < array.size(); i++) {
23503        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23504      }
23505    }
23506    ;
23507    if (json.has("documentation")) {
23508      JsonArray array = json.getAsJsonArray("documentation");
23509      for (int i = 0; i < array.size(); i++) {
23510        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23511      }
23512    }
23513    ;
23514    if (json.has("target")) {
23515      JsonArray array = json.getAsJsonArray("target");
23516      for (int i = 0; i < array.size(); i++) {
23517        res.getTarget()
23518            .add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
23519      }
23520    }
23521    ;
23522  }
23523
23524  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(
23525      JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
23526    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
23527    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
23528    return res;
23529  }
23530
23531  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner,
23532      PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
23533    parseBackboneElementProperties(json, res);
23534    if (json.has("measure"))
23535      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
23536    Type detail = parseType("detail", json);
23537    if (detail != null)
23538      res.setDetail(detail);
23539    if (json.has("due"))
23540      res.setDue(parseDuration(getJObject(json, "due")));
23541  }
23542
23543  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(
23544      JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
23545    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
23546    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
23547    return res;
23548  }
23549
23550  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner,
23551      PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
23552    parseBackboneElementProperties(json, res);
23553    if (json.has("prefix"))
23554      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
23555    if (json.has("_prefix"))
23556      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
23557    if (json.has("title"))
23558      res.setTitleElement(parseString(json.get("title").getAsString()));
23559    if (json.has("_title"))
23560      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23561    if (json.has("description"))
23562      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23563    if (json.has("_description"))
23564      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23565    if (json.has("textEquivalent"))
23566      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
23567    if (json.has("_textEquivalent"))
23568      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
23569    if (json.has("priority"))
23570      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), PlanDefinition.RequestPriority.NULL,
23571          new PlanDefinition.RequestPriorityEnumFactory()));
23572    if (json.has("_priority"))
23573      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
23574    if (json.has("code")) {
23575      JsonArray array = json.getAsJsonArray("code");
23576      for (int i = 0; i < array.size(); i++) {
23577        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23578      }
23579    }
23580    ;
23581    if (json.has("reason")) {
23582      JsonArray array = json.getAsJsonArray("reason");
23583      for (int i = 0; i < array.size(); i++) {
23584        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23585      }
23586    }
23587    ;
23588    if (json.has("documentation")) {
23589      JsonArray array = json.getAsJsonArray("documentation");
23590      for (int i = 0; i < array.size(); i++) {
23591        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23592      }
23593    }
23594    ;
23595    if (json.has("goalId")) {
23596      JsonArray array = json.getAsJsonArray("goalId");
23597      for (int i = 0; i < array.size(); i++) {
23598        if (array.get(i).isJsonNull()) {
23599          res.getGoalId().add(new IdType());
23600        } else {
23601          res.getGoalId().add(parseId(array.get(i).getAsString()));
23602        }
23603      }
23604    }
23605    ;
23606    if (json.has("_goalId")) {
23607      JsonArray array = json.getAsJsonArray("_goalId");
23608      for (int i = 0; i < array.size(); i++) {
23609        if (i == res.getGoalId().size())
23610          res.getGoalId().add(parseId(null));
23611        if (array.get(i) instanceof JsonObject)
23612          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
23613      }
23614    }
23615    ;
23616    Type subject = parseType("subject", json);
23617    if (subject != null)
23618      res.setSubject(subject);
23619    if (json.has("trigger")) {
23620      JsonArray array = json.getAsJsonArray("trigger");
23621      for (int i = 0; i < array.size(); i++) {
23622        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
23623      }
23624    }
23625    ;
23626    if (json.has("condition")) {
23627      JsonArray array = json.getAsJsonArray("condition");
23628      for (int i = 0; i < array.size(); i++) {
23629        res.getCondition()
23630            .add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
23631      }
23632    }
23633    ;
23634    if (json.has("input")) {
23635      JsonArray array = json.getAsJsonArray("input");
23636      for (int i = 0; i < array.size(); i++) {
23637        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
23638      }
23639    }
23640    ;
23641    if (json.has("output")) {
23642      JsonArray array = json.getAsJsonArray("output");
23643      for (int i = 0; i < array.size(); i++) {
23644        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
23645      }
23646    }
23647    ;
23648    if (json.has("relatedAction")) {
23649      JsonArray array = json.getAsJsonArray("relatedAction");
23650      for (int i = 0; i < array.size(); i++) {
23651        res.getRelatedAction()
23652            .add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
23653      }
23654    }
23655    ;
23656    Type timing = parseType("timing", json);
23657    if (timing != null)
23658      res.setTiming(timing);
23659    if (json.has("participant")) {
23660      JsonArray array = json.getAsJsonArray("participant");
23661      for (int i = 0; i < array.size(); i++) {
23662        res.getParticipant()
23663            .add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
23664      }
23665    }
23666    ;
23667    if (json.has("type"))
23668      res.setType(parseCodeableConcept(getJObject(json, "type")));
23669    if (json.has("groupingBehavior"))
23670      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(),
23671          PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
23672    if (json.has("_groupingBehavior"))
23673      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
23674    if (json.has("selectionBehavior"))
23675      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(),
23676          PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
23677    if (json.has("_selectionBehavior"))
23678      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
23679    if (json.has("requiredBehavior"))
23680      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(),
23681          PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
23682    if (json.has("_requiredBehavior"))
23683      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
23684    if (json.has("precheckBehavior"))
23685      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(),
23686          PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
23687    if (json.has("_precheckBehavior"))
23688      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
23689    if (json.has("cardinalityBehavior"))
23690      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(),
23691          PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
23692    if (json.has("_cardinalityBehavior"))
23693      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
23694    Type definition = parseType("definition", json);
23695    if (definition != null)
23696      res.setDefinition(definition);
23697    if (json.has("transform"))
23698      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
23699    if (json.has("_transform"))
23700      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
23701    if (json.has("dynamicValue")) {
23702      JsonArray array = json.getAsJsonArray("dynamicValue");
23703      for (int i = 0; i < array.size(); i++) {
23704        res.getDynamicValue()
23705            .add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
23706      }
23707    }
23708    ;
23709    if (json.has("action")) {
23710      JsonArray array = json.getAsJsonArray("action");
23711      for (int i = 0; i < array.size(); i++) {
23712        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
23713      }
23714    }
23715    ;
23716  }
23717
23718  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(
23719      JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
23720    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
23721    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
23722    return res;
23723  }
23724
23725  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json,
23726      PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res)
23727      throws IOException, FHIRFormatError {
23728    parseBackboneElementProperties(json, res);
23729    if (json.has("kind"))
23730      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL,
23731          new PlanDefinition.ActionConditionKindEnumFactory()));
23732    if (json.has("_kind"))
23733      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
23734    if (json.has("expression"))
23735      res.setExpression(parseExpression(getJObject(json, "expression")));
23736  }
23737
23738  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(
23739      JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
23740    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
23741    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
23742    return res;
23743  }
23744
23745  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json,
23746      PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res)
23747      throws IOException, FHIRFormatError {
23748    parseBackboneElementProperties(json, res);
23749    if (json.has("actionId"))
23750      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
23751    if (json.has("_actionId"))
23752      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
23753    if (json.has("relationship"))
23754      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(),
23755          PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
23756    if (json.has("_relationship"))
23757      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
23758    Type offset = parseType("offset", json);
23759    if (offset != null)
23760      res.setOffset(offset);
23761  }
23762
23763  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(
23764      JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
23765    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
23766    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
23767    return res;
23768  }
23769
23770  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json,
23771      PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res)
23772      throws IOException, FHIRFormatError {
23773    parseBackboneElementProperties(json, res);
23774    if (json.has("type"))
23775      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL,
23776          new PlanDefinition.ActionParticipantTypeEnumFactory()));
23777    if (json.has("_type"))
23778      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23779    if (json.has("role"))
23780      res.setRole(parseCodeableConcept(getJObject(json, "role")));
23781  }
23782
23783  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(
23784      JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
23785    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
23786    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
23787    return res;
23788  }
23789
23790  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json,
23791      PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res)
23792      throws IOException, FHIRFormatError {
23793    parseBackboneElementProperties(json, res);
23794    if (json.has("path"))
23795      res.setPathElement(parseString(json.get("path").getAsString()));
23796    if (json.has("_path"))
23797      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
23798    if (json.has("expression"))
23799      res.setExpression(parseExpression(getJObject(json, "expression")));
23800  }
23801
23802  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
23803    Practitioner res = new Practitioner();
23804    parsePractitionerProperties(json, res);
23805    return res;
23806  }
23807
23808  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
23809    parseDomainResourceProperties(json, res);
23810    if (json.has("identifier")) {
23811      JsonArray array = json.getAsJsonArray("identifier");
23812      for (int i = 0; i < array.size(); i++) {
23813        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23814      }
23815    }
23816    ;
23817    if (json.has("active"))
23818      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23819    if (json.has("_active"))
23820      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
23821    if (json.has("name")) {
23822      JsonArray array = json.getAsJsonArray("name");
23823      for (int i = 0; i < array.size(); i++) {
23824        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
23825      }
23826    }
23827    ;
23828    if (json.has("telecom")) {
23829      JsonArray array = json.getAsJsonArray("telecom");
23830      for (int i = 0; i < array.size(); i++) {
23831        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
23832      }
23833    }
23834    ;
23835    if (json.has("address")) {
23836      JsonArray array = json.getAsJsonArray("address");
23837      for (int i = 0; i < array.size(); i++) {
23838        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
23839      }
23840    }
23841    ;
23842    if (json.has("gender"))
23843      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL,
23844          new Enumerations.AdministrativeGenderEnumFactory()));
23845    if (json.has("_gender"))
23846      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
23847    if (json.has("birthDate"))
23848      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
23849    if (json.has("_birthDate"))
23850      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
23851    if (json.has("photo")) {
23852      JsonArray array = json.getAsJsonArray("photo");
23853      for (int i = 0; i < array.size(); i++) {
23854        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
23855      }
23856    }
23857    ;
23858    if (json.has("qualification")) {
23859      JsonArray array = json.getAsJsonArray("qualification");
23860      for (int i = 0; i < array.size(); i++) {
23861        res.getQualification()
23862            .add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
23863      }
23864    }
23865    ;
23866    if (json.has("communication")) {
23867      JsonArray array = json.getAsJsonArray("communication");
23868      for (int i = 0; i < array.size(); i++) {
23869        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23870      }
23871    }
23872    ;
23873  }
23874
23875  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(
23876      JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
23877    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
23878    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
23879    return res;
23880  }
23881
23882  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner,
23883      Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
23884    parseBackboneElementProperties(json, res);
23885    if (json.has("identifier")) {
23886      JsonArray array = json.getAsJsonArray("identifier");
23887      for (int i = 0; i < array.size(); i++) {
23888        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23889      }
23890    }
23891    ;
23892    if (json.has("code"))
23893      res.setCode(parseCodeableConcept(getJObject(json, "code")));
23894    if (json.has("period"))
23895      res.setPeriod(parsePeriod(getJObject(json, "period")));
23896    if (json.has("issuer"))
23897      res.setIssuer(parseReference(getJObject(json, "issuer")));
23898  }
23899
23900  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
23901    PractitionerRole res = new PractitionerRole();
23902    parsePractitionerRoleProperties(json, res);
23903    return res;
23904  }
23905
23906  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res)
23907      throws IOException, FHIRFormatError {
23908    parseDomainResourceProperties(json, res);
23909    if (json.has("identifier")) {
23910      JsonArray array = json.getAsJsonArray("identifier");
23911      for (int i = 0; i < array.size(); i++) {
23912        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23913      }
23914    }
23915    ;
23916    if (json.has("active"))
23917      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23918    if (json.has("_active"))
23919      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
23920    if (json.has("period"))
23921      res.setPeriod(parsePeriod(getJObject(json, "period")));
23922    if (json.has("practitioner"))
23923      res.setPractitioner(parseReference(getJObject(json, "practitioner")));
23924    if (json.has("organization"))
23925      res.setOrganization(parseReference(getJObject(json, "organization")));
23926    if (json.has("code")) {
23927      JsonArray array = json.getAsJsonArray("code");
23928      for (int i = 0; i < array.size(); i++) {
23929        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23930      }
23931    }
23932    ;
23933    if (json.has("specialty")) {
23934      JsonArray array = json.getAsJsonArray("specialty");
23935      for (int i = 0; i < array.size(); i++) {
23936        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23937      }
23938    }
23939    ;
23940    if (json.has("location")) {
23941      JsonArray array = json.getAsJsonArray("location");
23942      for (int i = 0; i < array.size(); i++) {
23943        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
23944      }
23945    }
23946    ;
23947    if (json.has("healthcareService")) {
23948      JsonArray array = json.getAsJsonArray("healthcareService");
23949      for (int i = 0; i < array.size(); i++) {
23950        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
23951      }
23952    }
23953    ;
23954    if (json.has("telecom")) {
23955      JsonArray array = json.getAsJsonArray("telecom");
23956      for (int i = 0; i < array.size(); i++) {
23957        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
23958      }
23959    }
23960    ;
23961    if (json.has("availableTime")) {
23962      JsonArray array = json.getAsJsonArray("availableTime");
23963      for (int i = 0; i < array.size(); i++) {
23964        res.getAvailableTime()
23965            .add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
23966      }
23967    }
23968    ;
23969    if (json.has("notAvailable")) {
23970      JsonArray array = json.getAsJsonArray("notAvailable");
23971      for (int i = 0; i < array.size(); i++) {
23972        res.getNotAvailable()
23973            .add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
23974      }
23975    }
23976    ;
23977    if (json.has("availabilityExceptions"))
23978      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
23979    if (json.has("_availabilityExceptions"))
23980      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
23981    if (json.has("endpoint")) {
23982      JsonArray array = json.getAsJsonArray("endpoint");
23983      for (int i = 0; i < array.size(); i++) {
23984        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
23985      }
23986    }
23987    ;
23988  }
23989
23990  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(
23991      JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
23992    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
23993    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
23994    return res;
23995  }
23996
23997  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json,
23998      PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res)
23999      throws IOException, FHIRFormatError {
24000    parseBackboneElementProperties(json, res);
24001    if (json.has("daysOfWeek")) {
24002      JsonArray array = json.getAsJsonArray("daysOfWeek");
24003      for (int i = 0; i < array.size(); i++) {
24004        if (array.get(i).isJsonNull()) {
24005          res.getDaysOfWeek().add(new Enumeration<PractitionerRole.DaysOfWeek>());
24006        } else {
24007          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL,
24008              new PractitionerRole.DaysOfWeekEnumFactory()));
24009        }
24010      }
24011    }
24012    ;
24013    if (json.has("_daysOfWeek")) {
24014      JsonArray array = json.getAsJsonArray("_daysOfWeek");
24015      for (int i = 0; i < array.size(); i++) {
24016        if (i == res.getDaysOfWeek().size())
24017          res.getDaysOfWeek().add(
24018              parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
24019        if (array.get(i) instanceof JsonObject)
24020          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
24021      }
24022    }
24023    ;
24024    if (json.has("allDay"))
24025      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
24026    if (json.has("_allDay"))
24027      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
24028    if (json.has("availableStartTime"))
24029      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
24030    if (json.has("_availableStartTime"))
24031      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
24032    if (json.has("availableEndTime"))
24033      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
24034    if (json.has("_availableEndTime"))
24035      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
24036  }
24037
24038  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(
24039      JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
24040    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
24041    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
24042    return res;
24043  }
24044
24045  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json,
24046      PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res)
24047      throws IOException, FHIRFormatError {
24048    parseBackboneElementProperties(json, res);
24049    if (json.has("description"))
24050      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24051    if (json.has("_description"))
24052      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24053    if (json.has("during"))
24054      res.setDuring(parsePeriod(getJObject(json, "during")));
24055  }
24056
24057  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
24058    Procedure res = new Procedure();
24059    parseProcedureProperties(json, res);
24060    return res;
24061  }
24062
24063  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
24064    parseDomainResourceProperties(json, res);
24065    if (json.has("identifier")) {
24066      JsonArray array = json.getAsJsonArray("identifier");
24067      for (int i = 0; i < array.size(); i++) {
24068        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24069      }
24070    }
24071    ;
24072    if (json.has("instantiatesCanonical")) {
24073      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
24074      for (int i = 0; i < array.size(); i++) {
24075        if (array.get(i).isJsonNull()) {
24076          res.getInstantiatesCanonical().add(new CanonicalType());
24077        } else {
24078          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
24079        }
24080      }
24081    }
24082    ;
24083    if (json.has("_instantiatesCanonical")) {
24084      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
24085      for (int i = 0; i < array.size(); i++) {
24086        if (i == res.getInstantiatesCanonical().size())
24087          res.getInstantiatesCanonical().add(parseCanonical(null));
24088        if (array.get(i) instanceof JsonObject)
24089          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
24090      }
24091    }
24092    ;
24093    if (json.has("instantiatesUri")) {
24094      JsonArray array = json.getAsJsonArray("instantiatesUri");
24095      for (int i = 0; i < array.size(); i++) {
24096        if (array.get(i).isJsonNull()) {
24097          res.getInstantiatesUri().add(new UriType());
24098        } else {
24099          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
24100        }
24101      }
24102    }
24103    ;
24104    if (json.has("_instantiatesUri")) {
24105      JsonArray array = json.getAsJsonArray("_instantiatesUri");
24106      for (int i = 0; i < array.size(); i++) {
24107        if (i == res.getInstantiatesUri().size())
24108          res.getInstantiatesUri().add(parseUri(null));
24109        if (array.get(i) instanceof JsonObject)
24110          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
24111      }
24112    }
24113    ;
24114    if (json.has("basedOn")) {
24115      JsonArray array = json.getAsJsonArray("basedOn");
24116      for (int i = 0; i < array.size(); i++) {
24117        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
24118      }
24119    }
24120    ;
24121    if (json.has("partOf")) {
24122      JsonArray array = json.getAsJsonArray("partOf");
24123      for (int i = 0; i < array.size(); i++) {
24124        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
24125      }
24126    }
24127    ;
24128    if (json.has("status"))
24129      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL,
24130          new Procedure.ProcedureStatusEnumFactory()));
24131    if (json.has("_status"))
24132      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24133    if (json.has("statusReason"))
24134      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
24135    if (json.has("category"))
24136      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
24137    if (json.has("code"))
24138      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24139    if (json.has("subject"))
24140      res.setSubject(parseReference(getJObject(json, "subject")));
24141    if (json.has("encounter"))
24142      res.setEncounter(parseReference(getJObject(json, "encounter")));
24143    Type performed = parseType("performed", json);
24144    if (performed != null)
24145      res.setPerformed(performed);
24146    if (json.has("recorder"))
24147      res.setRecorder(parseReference(getJObject(json, "recorder")));
24148    if (json.has("asserter"))
24149      res.setAsserter(parseReference(getJObject(json, "asserter")));
24150    if (json.has("performer")) {
24151      JsonArray array = json.getAsJsonArray("performer");
24152      for (int i = 0; i < array.size(); i++) {
24153        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
24154      }
24155    }
24156    ;
24157    if (json.has("location"))
24158      res.setLocation(parseReference(getJObject(json, "location")));
24159    if (json.has("reasonCode")) {
24160      JsonArray array = json.getAsJsonArray("reasonCode");
24161      for (int i = 0; i < array.size(); i++) {
24162        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24163      }
24164    }
24165    ;
24166    if (json.has("reasonReference")) {
24167      JsonArray array = json.getAsJsonArray("reasonReference");
24168      for (int i = 0; i < array.size(); i++) {
24169        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
24170      }
24171    }
24172    ;
24173    if (json.has("bodySite")) {
24174      JsonArray array = json.getAsJsonArray("bodySite");
24175      for (int i = 0; i < array.size(); i++) {
24176        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24177      }
24178    }
24179    ;
24180    if (json.has("outcome"))
24181      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
24182    if (json.has("report")) {
24183      JsonArray array = json.getAsJsonArray("report");
24184      for (int i = 0; i < array.size(); i++) {
24185        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
24186      }
24187    }
24188    ;
24189    if (json.has("complication")) {
24190      JsonArray array = json.getAsJsonArray("complication");
24191      for (int i = 0; i < array.size(); i++) {
24192        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24193      }
24194    }
24195    ;
24196    if (json.has("complicationDetail")) {
24197      JsonArray array = json.getAsJsonArray("complicationDetail");
24198      for (int i = 0; i < array.size(); i++) {
24199        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
24200      }
24201    }
24202    ;
24203    if (json.has("followUp")) {
24204      JsonArray array = json.getAsJsonArray("followUp");
24205      for (int i = 0; i < array.size(); i++) {
24206        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24207      }
24208    }
24209    ;
24210    if (json.has("note")) {
24211      JsonArray array = json.getAsJsonArray("note");
24212      for (int i = 0; i < array.size(); i++) {
24213        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24214      }
24215    }
24216    ;
24217    if (json.has("focalDevice")) {
24218      JsonArray array = json.getAsJsonArray("focalDevice");
24219      for (int i = 0; i < array.size(); i++) {
24220        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
24221      }
24222    }
24223    ;
24224    if (json.has("usedReference")) {
24225      JsonArray array = json.getAsJsonArray("usedReference");
24226      for (int i = 0; i < array.size(); i++) {
24227        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
24228      }
24229    }
24230    ;
24231    if (json.has("usedCode")) {
24232      JsonArray array = json.getAsJsonArray("usedCode");
24233      for (int i = 0; i < array.size(); i++) {
24234        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24235      }
24236    }
24237    ;
24238  }
24239
24240  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json,
24241      Procedure owner) throws IOException, FHIRFormatError {
24242    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
24243    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
24244    return res;
24245  }
24246
24247  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner,
24248      Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
24249    parseBackboneElementProperties(json, res);
24250    if (json.has("function"))
24251      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
24252    if (json.has("actor"))
24253      res.setActor(parseReference(getJObject(json, "actor")));
24254    if (json.has("onBehalfOf"))
24255      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
24256  }
24257
24258  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json,
24259      Procedure owner) throws IOException, FHIRFormatError {
24260    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
24261    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
24262    return res;
24263  }
24264
24265  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner,
24266      Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
24267    parseBackboneElementProperties(json, res);
24268    if (json.has("action"))
24269      res.setAction(parseCodeableConcept(getJObject(json, "action")));
24270    if (json.has("manipulated"))
24271      res.setManipulated(parseReference(getJObject(json, "manipulated")));
24272  }
24273
24274  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
24275    Provenance res = new Provenance();
24276    parseProvenanceProperties(json, res);
24277    return res;
24278  }
24279
24280  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
24281    parseDomainResourceProperties(json, res);
24282    if (json.has("target")) {
24283      JsonArray array = json.getAsJsonArray("target");
24284      for (int i = 0; i < array.size(); i++) {
24285        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
24286      }
24287    }
24288    ;
24289    Type occurred = parseType("occurred", json);
24290    if (occurred != null)
24291      res.setOccurred(occurred);
24292    if (json.has("recorded"))
24293      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
24294    if (json.has("_recorded"))
24295      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
24296    if (json.has("policy")) {
24297      JsonArray array = json.getAsJsonArray("policy");
24298      for (int i = 0; i < array.size(); i++) {
24299        if (array.get(i).isJsonNull()) {
24300          res.getPolicy().add(new UriType());
24301        } else {
24302          res.getPolicy().add(parseUri(array.get(i).getAsString()));
24303        }
24304      }
24305    }
24306    ;
24307    if (json.has("_policy")) {
24308      JsonArray array = json.getAsJsonArray("_policy");
24309      for (int i = 0; i < array.size(); i++) {
24310        if (i == res.getPolicy().size())
24311          res.getPolicy().add(parseUri(null));
24312        if (array.get(i) instanceof JsonObject)
24313          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
24314      }
24315    }
24316    ;
24317    if (json.has("location"))
24318      res.setLocation(parseReference(getJObject(json, "location")));
24319    if (json.has("reason")) {
24320      JsonArray array = json.getAsJsonArray("reason");
24321      for (int i = 0; i < array.size(); i++) {
24322        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24323      }
24324    }
24325    ;
24326    if (json.has("activity"))
24327      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
24328    if (json.has("agent")) {
24329      JsonArray array = json.getAsJsonArray("agent");
24330      for (int i = 0; i < array.size(); i++) {
24331        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
24332      }
24333    }
24334    ;
24335    if (json.has("entity")) {
24336      JsonArray array = json.getAsJsonArray("entity");
24337      for (int i = 0; i < array.size(); i++) {
24338        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
24339      }
24340    }
24341    ;
24342    if (json.has("signature")) {
24343      JsonArray array = json.getAsJsonArray("signature");
24344      for (int i = 0; i < array.size(); i++) {
24345        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
24346      }
24347    }
24348    ;
24349  }
24350
24351  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json,
24352      Provenance owner) throws IOException, FHIRFormatError {
24353    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
24354    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
24355    return res;
24356  }
24357
24358  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner,
24359      Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
24360    parseBackboneElementProperties(json, res);
24361    if (json.has("type"))
24362      res.setType(parseCodeableConcept(getJObject(json, "type")));
24363    if (json.has("role")) {
24364      JsonArray array = json.getAsJsonArray("role");
24365      for (int i = 0; i < array.size(); i++) {
24366        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24367      }
24368    }
24369    ;
24370    if (json.has("who"))
24371      res.setWho(parseReference(getJObject(json, "who")));
24372    if (json.has("onBehalfOf"))
24373      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
24374  }
24375
24376  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json,
24377      Provenance owner) throws IOException, FHIRFormatError {
24378    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
24379    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
24380    return res;
24381  }
24382
24383  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner,
24384      Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
24385    parseBackboneElementProperties(json, res);
24386    if (json.has("role"))
24387      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL,
24388          new Provenance.ProvenanceEntityRoleEnumFactory()));
24389    if (json.has("_role"))
24390      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
24391    if (json.has("what"))
24392      res.setWhat(parseReference(getJObject(json, "what")));
24393    if (json.has("agent")) {
24394      JsonArray array = json.getAsJsonArray("agent");
24395      for (int i = 0; i < array.size(); i++) {
24396        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
24397      }
24398    }
24399    ;
24400  }
24401
24402  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
24403    Questionnaire res = new Questionnaire();
24404    parseQuestionnaireProperties(json, res);
24405    return res;
24406  }
24407
24408  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
24409    parseDomainResourceProperties(json, res);
24410    if (json.has("url"))
24411      res.setUrlElement(parseUri(json.get("url").getAsString()));
24412    if (json.has("_url"))
24413      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24414    if (json.has("identifier")) {
24415      JsonArray array = json.getAsJsonArray("identifier");
24416      for (int i = 0; i < array.size(); i++) {
24417        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24418      }
24419    }
24420    ;
24421    if (json.has("version"))
24422      res.setVersionElement(parseString(json.get("version").getAsString()));
24423    if (json.has("_version"))
24424      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
24425    if (json.has("name"))
24426      res.setNameElement(parseString(json.get("name").getAsString()));
24427    if (json.has("_name"))
24428      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24429    if (json.has("title"))
24430      res.setTitleElement(parseString(json.get("title").getAsString()));
24431    if (json.has("_title"))
24432      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
24433    if (json.has("derivedFrom")) {
24434      JsonArray array = json.getAsJsonArray("derivedFrom");
24435      for (int i = 0; i < array.size(); i++) {
24436        if (array.get(i).isJsonNull()) {
24437          res.getDerivedFrom().add(new CanonicalType());
24438        } else {
24439          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
24440        }
24441      }
24442    }
24443    ;
24444    if (json.has("_derivedFrom")) {
24445      JsonArray array = json.getAsJsonArray("_derivedFrom");
24446      for (int i = 0; i < array.size(); i++) {
24447        if (i == res.getDerivedFrom().size())
24448          res.getDerivedFrom().add(parseCanonical(null));
24449        if (array.get(i) instanceof JsonObject)
24450          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
24451      }
24452    }
24453    ;
24454    if (json.has("status"))
24455      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
24456          new Enumerations.PublicationStatusEnumFactory()));
24457    if (json.has("_status"))
24458      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24459    if (json.has("experimental"))
24460      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24461    if (json.has("_experimental"))
24462      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
24463    if (json.has("subjectType")) {
24464      JsonArray array = json.getAsJsonArray("subjectType");
24465      for (int i = 0; i < array.size(); i++) {
24466        if (array.get(i).isJsonNull()) {
24467          res.getSubjectType().add(new CodeType());
24468        } else {
24469          res.getSubjectType().add(parseCode(array.get(i).getAsString()));
24470        }
24471      }
24472    }
24473    ;
24474    if (json.has("_subjectType")) {
24475      JsonArray array = json.getAsJsonArray("_subjectType");
24476      for (int i = 0; i < array.size(); i++) {
24477        if (i == res.getSubjectType().size())
24478          res.getSubjectType().add(parseCode(null));
24479        if (array.get(i) instanceof JsonObject)
24480          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
24481      }
24482    }
24483    ;
24484    if (json.has("date"))
24485      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24486    if (json.has("_date"))
24487      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
24488    if (json.has("publisher"))
24489      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24490    if (json.has("_publisher"))
24491      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
24492    if (json.has("contact")) {
24493      JsonArray array = json.getAsJsonArray("contact");
24494      for (int i = 0; i < array.size(); i++) {
24495        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24496      }
24497    }
24498    ;
24499    if (json.has("description"))
24500      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24501    if (json.has("_description"))
24502      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24503    if (json.has("useContext")) {
24504      JsonArray array = json.getAsJsonArray("useContext");
24505      for (int i = 0; i < array.size(); i++) {
24506        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24507      }
24508    }
24509    ;
24510    if (json.has("jurisdiction")) {
24511      JsonArray array = json.getAsJsonArray("jurisdiction");
24512      for (int i = 0; i < array.size(); i++) {
24513        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24514      }
24515    }
24516    ;
24517    if (json.has("purpose"))
24518      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24519    if (json.has("_purpose"))
24520      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
24521    if (json.has("copyright"))
24522      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24523    if (json.has("_copyright"))
24524      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
24525    if (json.has("approvalDate"))
24526      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
24527    if (json.has("_approvalDate"))
24528      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
24529    if (json.has("lastReviewDate"))
24530      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
24531    if (json.has("_lastReviewDate"))
24532      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
24533    if (json.has("effectivePeriod"))
24534      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
24535    if (json.has("code")) {
24536      JsonArray array = json.getAsJsonArray("code");
24537      for (int i = 0; i < array.size(); i++) {
24538        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
24539      }
24540    }
24541    ;
24542    if (json.has("item")) {
24543      JsonArray array = json.getAsJsonArray("item");
24544      for (int i = 0; i < array.size(); i++) {
24545        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
24546      }
24547    }
24548    ;
24549  }
24550
24551  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json,
24552      Questionnaire owner) throws IOException, FHIRFormatError {
24553    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
24554    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
24555    return res;
24556  }
24557
24558  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner,
24559      Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
24560    parseBackboneElementProperties(json, res);
24561    if (json.has("linkId"))
24562      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
24563    if (json.has("_linkId"))
24564      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
24565    if (json.has("definition"))
24566      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
24567    if (json.has("_definition"))
24568      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
24569    if (json.has("code")) {
24570      JsonArray array = json.getAsJsonArray("code");
24571      for (int i = 0; i < array.size(); i++) {
24572        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
24573      }
24574    }
24575    ;
24576    if (json.has("prefix"))
24577      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
24578    if (json.has("_prefix"))
24579      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
24580    if (json.has("text"))
24581      res.setTextElement(parseString(json.get("text").getAsString()));
24582    if (json.has("_text"))
24583      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
24584    if (json.has("type"))
24585      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL,
24586          new Questionnaire.QuestionnaireItemTypeEnumFactory()));
24587    if (json.has("_type"))
24588      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24589    if (json.has("enableWhen")) {
24590      JsonArray array = json.getAsJsonArray("enableWhen");
24591      for (int i = 0; i < array.size(); i++) {
24592        res.getEnableWhen()
24593            .add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
24594      }
24595    }
24596    ;
24597    if (json.has("enableBehavior"))
24598      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(),
24599          Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
24600    if (json.has("_enableBehavior"))
24601      parseElementProperties(getJObject(json, "_enableBehavior"), res.getEnableBehaviorElement());
24602    if (json.has("required"))
24603      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
24604    if (json.has("_required"))
24605      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
24606    if (json.has("repeats"))
24607      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
24608    if (json.has("_repeats"))
24609      parseElementProperties(getJObject(json, "_repeats"), res.getRepeatsElement());
24610    if (json.has("readOnly"))
24611      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
24612    if (json.has("_readOnly"))
24613      parseElementProperties(getJObject(json, "_readOnly"), res.getReadOnlyElement());
24614    if (json.has("maxLength"))
24615      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
24616    if (json.has("_maxLength"))
24617      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
24618    if (json.has("answerValueSet"))
24619      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
24620    if (json.has("_answerValueSet"))
24621      parseElementProperties(getJObject(json, "_answerValueSet"), res.getAnswerValueSetElement());
24622    if (json.has("answerOption")) {
24623      JsonArray array = json.getAsJsonArray("answerOption");
24624      for (int i = 0; i < array.size(); i++) {
24625        res.getAnswerOption()
24626            .add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject(), owner));
24627      }
24628    }
24629    ;
24630    if (json.has("initial")) {
24631      JsonArray array = json.getAsJsonArray("initial");
24632      for (int i = 0; i < array.size(); i++) {
24633        res.getInitial()
24634            .add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
24635      }
24636    }
24637    ;
24638    if (json.has("item")) {
24639      JsonArray array = json.getAsJsonArray("item");
24640      for (int i = 0; i < array.size(); i++) {
24641        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
24642      }
24643    }
24644    ;
24645  }
24646
24647  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(
24648      JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
24649    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
24650    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
24651    return res;
24652  }
24653
24654  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner,
24655      Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
24656    parseBackboneElementProperties(json, res);
24657    if (json.has("question"))
24658      res.setQuestionElement(parseString(json.get("question").getAsString()));
24659    if (json.has("_question"))
24660      parseElementProperties(getJObject(json, "_question"), res.getQuestionElement());
24661    if (json.has("operator"))
24662      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(),
24663          Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
24664    if (json.has("_operator"))
24665      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
24666    Type answer = parseType("answer", json);
24667    if (answer != null)
24668      res.setAnswer(answer);
24669  }
24670
24671  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireQuestionnaireItemAnswerOptionComponent(
24672      JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
24673    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
24674    parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(json, owner, res);
24675    return res;
24676  }
24677
24678  protected void parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(JsonObject json,
24679      Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent res)
24680      throws IOException, FHIRFormatError {
24681    parseBackboneElementProperties(json, res);
24682    Type value = parseType("value", json);
24683    if (value != null)
24684      res.setValue(value);
24685    if (json.has("initialSelected"))
24686      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
24687    if (json.has("_initialSelected"))
24688      parseElementProperties(getJObject(json, "_initialSelected"), res.getInitialSelectedElement());
24689  }
24690
24691  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(
24692      JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
24693    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
24694    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
24695    return res;
24696  }
24697
24698  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner,
24699      Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
24700    parseBackboneElementProperties(json, res);
24701    Type value = parseType("value", json);
24702    if (value != null)
24703      res.setValue(value);
24704  }
24705
24706  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
24707    QuestionnaireResponse res = new QuestionnaireResponse();
24708    parseQuestionnaireResponseProperties(json, res);
24709    return res;
24710  }
24711
24712  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res)
24713      throws IOException, FHIRFormatError {
24714    parseDomainResourceProperties(json, res);
24715    if (json.has("identifier"))
24716      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24717    if (json.has("basedOn")) {
24718      JsonArray array = json.getAsJsonArray("basedOn");
24719      for (int i = 0; i < array.size(); i++) {
24720        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
24721      }
24722    }
24723    ;
24724    if (json.has("partOf")) {
24725      JsonArray array = json.getAsJsonArray("partOf");
24726      for (int i = 0; i < array.size(); i++) {
24727        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
24728      }
24729    }
24730    ;
24731    if (json.has("questionnaire"))
24732      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
24733    if (json.has("_questionnaire"))
24734      parseElementProperties(getJObject(json, "_questionnaire"), res.getQuestionnaireElement());
24735    if (json.has("status"))
24736      res.setStatusElement(
24737          parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL,
24738              new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
24739    if (json.has("_status"))
24740      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24741    if (json.has("subject"))
24742      res.setSubject(parseReference(getJObject(json, "subject")));
24743    if (json.has("encounter"))
24744      res.setEncounter(parseReference(getJObject(json, "encounter")));
24745    if (json.has("authored"))
24746      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
24747    if (json.has("_authored"))
24748      parseElementProperties(getJObject(json, "_authored"), res.getAuthoredElement());
24749    if (json.has("author"))
24750      res.setAuthor(parseReference(getJObject(json, "author")));
24751    if (json.has("source"))
24752      res.setSource(parseReference(getJObject(json, "source")));
24753    if (json.has("item")) {
24754      JsonArray array = json.getAsJsonArray("item");
24755      for (int i = 0; i < array.size(); i++) {
24756        res.getItem()
24757            .add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
24758      }
24759    }
24760    ;
24761  }
24762
24763  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(
24764      JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
24765    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
24766    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
24767    return res;
24768  }
24769
24770  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json,
24771      QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res)
24772      throws IOException, FHIRFormatError {
24773    parseBackboneElementProperties(json, res);
24774    if (json.has("linkId"))
24775      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
24776    if (json.has("_linkId"))
24777      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
24778    if (json.has("definition"))
24779      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
24780    if (json.has("_definition"))
24781      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
24782    if (json.has("text"))
24783      res.setTextElement(parseString(json.get("text").getAsString()));
24784    if (json.has("_text"))
24785      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
24786    if (json.has("answer")) {
24787      JsonArray array = json.getAsJsonArray("answer");
24788      for (int i = 0; i < array.size(); i++) {
24789        res.getAnswer().add(
24790            parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
24791      }
24792    }
24793    ;
24794    if (json.has("item")) {
24795      JsonArray array = json.getAsJsonArray("item");
24796      for (int i = 0; i < array.size(); i++) {
24797        res.getItem()
24798            .add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
24799      }
24800    }
24801    ;
24802  }
24803
24804  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(
24805      JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
24806    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
24807    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
24808    return res;
24809  }
24810
24811  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json,
24812      QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res)
24813      throws IOException, FHIRFormatError {
24814    parseBackboneElementProperties(json, res);
24815    Type value = parseType("value", json);
24816    if (value != null)
24817      res.setValue(value);
24818    if (json.has("item")) {
24819      JsonArray array = json.getAsJsonArray("item");
24820      for (int i = 0; i < array.size(); i++) {
24821        res.getItem()
24822            .add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
24823      }
24824    }
24825    ;
24826  }
24827
24828  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
24829    RelatedPerson res = new RelatedPerson();
24830    parseRelatedPersonProperties(json, res);
24831    return res;
24832  }
24833
24834  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
24835    parseDomainResourceProperties(json, res);
24836    if (json.has("identifier")) {
24837      JsonArray array = json.getAsJsonArray("identifier");
24838      for (int i = 0; i < array.size(); i++) {
24839        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24840      }
24841    }
24842    ;
24843    if (json.has("active"))
24844      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
24845    if (json.has("_active"))
24846      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
24847    if (json.has("patient"))
24848      res.setPatient(parseReference(getJObject(json, "patient")));
24849    if (json.has("relationship")) {
24850      JsonArray array = json.getAsJsonArray("relationship");
24851      for (int i = 0; i < array.size(); i++) {
24852        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24853      }
24854    }
24855    ;
24856    if (json.has("name")) {
24857      JsonArray array = json.getAsJsonArray("name");
24858      for (int i = 0; i < array.size(); i++) {
24859        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
24860      }
24861    }
24862    ;
24863    if (json.has("telecom")) {
24864      JsonArray array = json.getAsJsonArray("telecom");
24865      for (int i = 0; i < array.size(); i++) {
24866        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
24867      }
24868    }
24869    ;
24870    if (json.has("gender"))
24871      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL,
24872          new Enumerations.AdministrativeGenderEnumFactory()));
24873    if (json.has("_gender"))
24874      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
24875    if (json.has("birthDate"))
24876      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
24877    if (json.has("_birthDate"))
24878      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
24879    if (json.has("address")) {
24880      JsonArray array = json.getAsJsonArray("address");
24881      for (int i = 0; i < array.size(); i++) {
24882        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
24883      }
24884    }
24885    ;
24886    if (json.has("photo")) {
24887      JsonArray array = json.getAsJsonArray("photo");
24888      for (int i = 0; i < array.size(); i++) {
24889        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
24890      }
24891    }
24892    ;
24893    if (json.has("period"))
24894      res.setPeriod(parsePeriod(getJObject(json, "period")));
24895    if (json.has("communication")) {
24896      JsonArray array = json.getAsJsonArray("communication");
24897      for (int i = 0; i < array.size(); i++) {
24898        res.getCommunication()
24899            .add(parseRelatedPersonRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject(), res));
24900      }
24901    }
24902    ;
24903  }
24904
24905  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonRelatedPersonCommunicationComponent(
24906      JsonObject json, RelatedPerson owner) throws IOException, FHIRFormatError {
24907    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
24908    parseRelatedPersonRelatedPersonCommunicationComponentProperties(json, owner, res);
24909    return res;
24910  }
24911
24912  protected void parseRelatedPersonRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson owner,
24913      RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
24914    parseBackboneElementProperties(json, res);
24915    if (json.has("language"))
24916      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
24917    if (json.has("preferred"))
24918      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
24919    if (json.has("_preferred"))
24920      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
24921  }
24922
24923  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
24924    RequestGroup res = new RequestGroup();
24925    parseRequestGroupProperties(json, res);
24926    return res;
24927  }
24928
24929  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
24930    parseDomainResourceProperties(json, res);
24931    if (json.has("identifier")) {
24932      JsonArray array = json.getAsJsonArray("identifier");
24933      for (int i = 0; i < array.size(); i++) {
24934        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24935      }
24936    }
24937    ;
24938    if (json.has("instantiatesCanonical")) {
24939      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
24940      for (int i = 0; i < array.size(); i++) {
24941        if (array.get(i).isJsonNull()) {
24942          res.getInstantiatesCanonical().add(new CanonicalType());
24943        } else {
24944          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
24945        }
24946      }
24947    }
24948    ;
24949    if (json.has("_instantiatesCanonical")) {
24950      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
24951      for (int i = 0; i < array.size(); i++) {
24952        if (i == res.getInstantiatesCanonical().size())
24953          res.getInstantiatesCanonical().add(parseCanonical(null));
24954        if (array.get(i) instanceof JsonObject)
24955          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
24956      }
24957    }
24958    ;
24959    if (json.has("instantiatesUri")) {
24960      JsonArray array = json.getAsJsonArray("instantiatesUri");
24961      for (int i = 0; i < array.size(); i++) {
24962        if (array.get(i).isJsonNull()) {
24963          res.getInstantiatesUri().add(new UriType());
24964        } else {
24965          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
24966        }
24967      }
24968    }
24969    ;
24970    if (json.has("_instantiatesUri")) {
24971      JsonArray array = json.getAsJsonArray("_instantiatesUri");
24972      for (int i = 0; i < array.size(); i++) {
24973        if (i == res.getInstantiatesUri().size())
24974          res.getInstantiatesUri().add(parseUri(null));
24975        if (array.get(i) instanceof JsonObject)
24976          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
24977      }
24978    }
24979    ;
24980    if (json.has("basedOn")) {
24981      JsonArray array = json.getAsJsonArray("basedOn");
24982      for (int i = 0; i < array.size(); i++) {
24983        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
24984      }
24985    }
24986    ;
24987    if (json.has("replaces")) {
24988      JsonArray array = json.getAsJsonArray("replaces");
24989      for (int i = 0; i < array.size(); i++) {
24990        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
24991      }
24992    }
24993    ;
24994    if (json.has("groupIdentifier"))
24995      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
24996    if (json.has("status"))
24997      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL,
24998          new RequestGroup.RequestStatusEnumFactory()));
24999    if (json.has("_status"))
25000      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25001    if (json.has("intent"))
25002      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL,
25003          new RequestGroup.RequestIntentEnumFactory()));
25004    if (json.has("_intent"))
25005      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
25006    if (json.has("priority"))
25007      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL,
25008          new RequestGroup.RequestPriorityEnumFactory()));
25009    if (json.has("_priority"))
25010      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
25011    if (json.has("code"))
25012      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25013    if (json.has("subject"))
25014      res.setSubject(parseReference(getJObject(json, "subject")));
25015    if (json.has("encounter"))
25016      res.setEncounter(parseReference(getJObject(json, "encounter")));
25017    if (json.has("authoredOn"))
25018      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25019    if (json.has("_authoredOn"))
25020      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
25021    if (json.has("author"))
25022      res.setAuthor(parseReference(getJObject(json, "author")));
25023    if (json.has("reasonCode")) {
25024      JsonArray array = json.getAsJsonArray("reasonCode");
25025      for (int i = 0; i < array.size(); i++) {
25026        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25027      }
25028    }
25029    ;
25030    if (json.has("reasonReference")) {
25031      JsonArray array = json.getAsJsonArray("reasonReference");
25032      for (int i = 0; i < array.size(); i++) {
25033        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
25034      }
25035    }
25036    ;
25037    if (json.has("note")) {
25038      JsonArray array = json.getAsJsonArray("note");
25039      for (int i = 0; i < array.size(); i++) {
25040        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25041      }
25042    }
25043    ;
25044    if (json.has("action")) {
25045      JsonArray array = json.getAsJsonArray("action");
25046      for (int i = 0; i < array.size(); i++) {
25047        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
25048      }
25049    }
25050    ;
25051  }
25052
25053  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json,
25054      RequestGroup owner) throws IOException, FHIRFormatError {
25055    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
25056    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
25057    return res;
25058  }
25059
25060  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner,
25061      RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
25062    parseBackboneElementProperties(json, res);
25063    if (json.has("prefix"))
25064      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
25065    if (json.has("_prefix"))
25066      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
25067    if (json.has("title"))
25068      res.setTitleElement(parseString(json.get("title").getAsString()));
25069    if (json.has("_title"))
25070      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25071    if (json.has("description"))
25072      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25073    if (json.has("_description"))
25074      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25075    if (json.has("textEquivalent"))
25076      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
25077    if (json.has("_textEquivalent"))
25078      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
25079    if (json.has("priority"))
25080      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL,
25081          new RequestGroup.RequestPriorityEnumFactory()));
25082    if (json.has("_priority"))
25083      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
25084    if (json.has("code")) {
25085      JsonArray array = json.getAsJsonArray("code");
25086      for (int i = 0; i < array.size(); i++) {
25087        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25088      }
25089    }
25090    ;
25091    if (json.has("documentation")) {
25092      JsonArray array = json.getAsJsonArray("documentation");
25093      for (int i = 0; i < array.size(); i++) {
25094        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
25095      }
25096    }
25097    ;
25098    if (json.has("condition")) {
25099      JsonArray array = json.getAsJsonArray("condition");
25100      for (int i = 0; i < array.size(); i++) {
25101        res.getCondition()
25102            .add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
25103      }
25104    }
25105    ;
25106    if (json.has("relatedAction")) {
25107      JsonArray array = json.getAsJsonArray("relatedAction");
25108      for (int i = 0; i < array.size(); i++) {
25109        res.getRelatedAction()
25110            .add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
25111      }
25112    }
25113    ;
25114    Type timing = parseType("timing", json);
25115    if (timing != null)
25116      res.setTiming(timing);
25117    if (json.has("participant")) {
25118      JsonArray array = json.getAsJsonArray("participant");
25119      for (int i = 0; i < array.size(); i++) {
25120        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
25121      }
25122    }
25123    ;
25124    if (json.has("type"))
25125      res.setType(parseCodeableConcept(getJObject(json, "type")));
25126    if (json.has("groupingBehavior"))
25127      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(),
25128          RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
25129    if (json.has("_groupingBehavior"))
25130      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
25131    if (json.has("selectionBehavior"))
25132      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(),
25133          RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
25134    if (json.has("_selectionBehavior"))
25135      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
25136    if (json.has("requiredBehavior"))
25137      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(),
25138          RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
25139    if (json.has("_requiredBehavior"))
25140      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
25141    if (json.has("precheckBehavior"))
25142      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(),
25143          RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
25144    if (json.has("_precheckBehavior"))
25145      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
25146    if (json.has("cardinalityBehavior"))
25147      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(),
25148          RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
25149    if (json.has("_cardinalityBehavior"))
25150      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
25151    if (json.has("resource"))
25152      res.setResource(parseReference(getJObject(json, "resource")));
25153    if (json.has("action")) {
25154      JsonArray array = json.getAsJsonArray("action");
25155      for (int i = 0; i < array.size(); i++) {
25156        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
25157      }
25158    }
25159    ;
25160  }
25161
25162  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(
25163      JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
25164    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
25165    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
25166    return res;
25167  }
25168
25169  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner,
25170      RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
25171    parseBackboneElementProperties(json, res);
25172    if (json.has("kind"))
25173      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL,
25174          new RequestGroup.ActionConditionKindEnumFactory()));
25175    if (json.has("_kind"))
25176      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
25177    if (json.has("expression"))
25178      res.setExpression(parseExpression(getJObject(json, "expression")));
25179  }
25180
25181  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(
25182      JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
25183    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
25184    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
25185    return res;
25186  }
25187
25188  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json,
25189      RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res)
25190      throws IOException, FHIRFormatError {
25191    parseBackboneElementProperties(json, res);
25192    if (json.has("actionId"))
25193      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
25194    if (json.has("_actionId"))
25195      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
25196    if (json.has("relationship"))
25197      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(),
25198          RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
25199    if (json.has("_relationship"))
25200      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
25201    Type offset = parseType("offset", json);
25202    if (offset != null)
25203      res.setOffset(offset);
25204  }
25205
25206  protected ResearchDefinition parseResearchDefinition(JsonObject json) throws IOException, FHIRFormatError {
25207    ResearchDefinition res = new ResearchDefinition();
25208    parseResearchDefinitionProperties(json, res);
25209    return res;
25210  }
25211
25212  protected void parseResearchDefinitionProperties(JsonObject json, ResearchDefinition res)
25213      throws IOException, FHIRFormatError {
25214    parseDomainResourceProperties(json, res);
25215    if (json.has("url"))
25216      res.setUrlElement(parseUri(json.get("url").getAsString()));
25217    if (json.has("_url"))
25218      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
25219    if (json.has("identifier")) {
25220      JsonArray array = json.getAsJsonArray("identifier");
25221      for (int i = 0; i < array.size(); i++) {
25222        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25223      }
25224    }
25225    ;
25226    if (json.has("version"))
25227      res.setVersionElement(parseString(json.get("version").getAsString()));
25228    if (json.has("_version"))
25229      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
25230    if (json.has("name"))
25231      res.setNameElement(parseString(json.get("name").getAsString()));
25232    if (json.has("_name"))
25233      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25234    if (json.has("title"))
25235      res.setTitleElement(parseString(json.get("title").getAsString()));
25236    if (json.has("_title"))
25237      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25238    if (json.has("shortTitle"))
25239      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
25240    if (json.has("_shortTitle"))
25241      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
25242    if (json.has("subtitle"))
25243      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
25244    if (json.has("_subtitle"))
25245      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
25246    if (json.has("status"))
25247      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
25248          new Enumerations.PublicationStatusEnumFactory()));
25249    if (json.has("_status"))
25250      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25251    if (json.has("experimental"))
25252      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25253    if (json.has("_experimental"))
25254      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
25255    Type subject = parseType("subject", json);
25256    if (subject != null)
25257      res.setSubject(subject);
25258    if (json.has("date"))
25259      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25260    if (json.has("_date"))
25261      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25262    if (json.has("publisher"))
25263      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25264    if (json.has("_publisher"))
25265      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
25266    if (json.has("contact")) {
25267      JsonArray array = json.getAsJsonArray("contact");
25268      for (int i = 0; i < array.size(); i++) {
25269        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25270      }
25271    }
25272    ;
25273    if (json.has("description"))
25274      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25275    if (json.has("_description"))
25276      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25277    if (json.has("comment")) {
25278      JsonArray array = json.getAsJsonArray("comment");
25279      for (int i = 0; i < array.size(); i++) {
25280        if (array.get(i).isJsonNull()) {
25281          res.getComment().add(new StringType());
25282        } else {
25283          res.getComment().add(parseString(array.get(i).getAsString()));
25284        }
25285      }
25286    }
25287    ;
25288    if (json.has("_comment")) {
25289      JsonArray array = json.getAsJsonArray("_comment");
25290      for (int i = 0; i < array.size(); i++) {
25291        if (i == res.getComment().size())
25292          res.getComment().add(parseString(null));
25293        if (array.get(i) instanceof JsonObject)
25294          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
25295      }
25296    }
25297    ;
25298    if (json.has("useContext")) {
25299      JsonArray array = json.getAsJsonArray("useContext");
25300      for (int i = 0; i < array.size(); i++) {
25301        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25302      }
25303    }
25304    ;
25305    if (json.has("jurisdiction")) {
25306      JsonArray array = json.getAsJsonArray("jurisdiction");
25307      for (int i = 0; i < array.size(); i++) {
25308        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25309      }
25310    }
25311    ;
25312    if (json.has("purpose"))
25313      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25314    if (json.has("_purpose"))
25315      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
25316    if (json.has("usage"))
25317      res.setUsageElement(parseString(json.get("usage").getAsString()));
25318    if (json.has("_usage"))
25319      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
25320    if (json.has("copyright"))
25321      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25322    if (json.has("_copyright"))
25323      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
25324    if (json.has("approvalDate"))
25325      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
25326    if (json.has("_approvalDate"))
25327      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
25328    if (json.has("lastReviewDate"))
25329      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
25330    if (json.has("_lastReviewDate"))
25331      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
25332    if (json.has("effectivePeriod"))
25333      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
25334    if (json.has("topic")) {
25335      JsonArray array = json.getAsJsonArray("topic");
25336      for (int i = 0; i < array.size(); i++) {
25337        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25338      }
25339    }
25340    ;
25341    if (json.has("author")) {
25342      JsonArray array = json.getAsJsonArray("author");
25343      for (int i = 0; i < array.size(); i++) {
25344        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
25345      }
25346    }
25347    ;
25348    if (json.has("editor")) {
25349      JsonArray array = json.getAsJsonArray("editor");
25350      for (int i = 0; i < array.size(); i++) {
25351        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
25352      }
25353    }
25354    ;
25355    if (json.has("reviewer")) {
25356      JsonArray array = json.getAsJsonArray("reviewer");
25357      for (int i = 0; i < array.size(); i++) {
25358        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
25359      }
25360    }
25361    ;
25362    if (json.has("endorser")) {
25363      JsonArray array = json.getAsJsonArray("endorser");
25364      for (int i = 0; i < array.size(); i++) {
25365        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
25366      }
25367    }
25368    ;
25369    if (json.has("relatedArtifact")) {
25370      JsonArray array = json.getAsJsonArray("relatedArtifact");
25371      for (int i = 0; i < array.size(); i++) {
25372        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
25373      }
25374    }
25375    ;
25376    if (json.has("library")) {
25377      JsonArray array = json.getAsJsonArray("library");
25378      for (int i = 0; i < array.size(); i++) {
25379        if (array.get(i).isJsonNull()) {
25380          res.getLibrary().add(new CanonicalType());
25381        } else {
25382          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
25383        }
25384      }
25385    }
25386    ;
25387    if (json.has("_library")) {
25388      JsonArray array = json.getAsJsonArray("_library");
25389      for (int i = 0; i < array.size(); i++) {
25390        if (i == res.getLibrary().size())
25391          res.getLibrary().add(parseCanonical(null));
25392        if (array.get(i) instanceof JsonObject)
25393          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
25394      }
25395    }
25396    ;
25397    if (json.has("population"))
25398      res.setPopulation(parseReference(getJObject(json, "population")));
25399    if (json.has("exposure"))
25400      res.setExposure(parseReference(getJObject(json, "exposure")));
25401    if (json.has("exposureAlternative"))
25402      res.setExposureAlternative(parseReference(getJObject(json, "exposureAlternative")));
25403    if (json.has("outcome"))
25404      res.setOutcome(parseReference(getJObject(json, "outcome")));
25405  }
25406
25407  protected ResearchElementDefinition parseResearchElementDefinition(JsonObject json)
25408      throws IOException, FHIRFormatError {
25409    ResearchElementDefinition res = new ResearchElementDefinition();
25410    parseResearchElementDefinitionProperties(json, res);
25411    return res;
25412  }
25413
25414  protected void parseResearchElementDefinitionProperties(JsonObject json, ResearchElementDefinition res)
25415      throws IOException, FHIRFormatError {
25416    parseDomainResourceProperties(json, res);
25417    if (json.has("url"))
25418      res.setUrlElement(parseUri(json.get("url").getAsString()));
25419    if (json.has("_url"))
25420      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
25421    if (json.has("identifier")) {
25422      JsonArray array = json.getAsJsonArray("identifier");
25423      for (int i = 0; i < array.size(); i++) {
25424        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25425      }
25426    }
25427    ;
25428    if (json.has("version"))
25429      res.setVersionElement(parseString(json.get("version").getAsString()));
25430    if (json.has("_version"))
25431      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
25432    if (json.has("name"))
25433      res.setNameElement(parseString(json.get("name").getAsString()));
25434    if (json.has("_name"))
25435      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25436    if (json.has("title"))
25437      res.setTitleElement(parseString(json.get("title").getAsString()));
25438    if (json.has("_title"))
25439      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25440    if (json.has("shortTitle"))
25441      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
25442    if (json.has("_shortTitle"))
25443      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
25444    if (json.has("subtitle"))
25445      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
25446    if (json.has("_subtitle"))
25447      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
25448    if (json.has("status"))
25449      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
25450          new Enumerations.PublicationStatusEnumFactory()));
25451    if (json.has("_status"))
25452      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25453    if (json.has("experimental"))
25454      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25455    if (json.has("_experimental"))
25456      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
25457    Type subject = parseType("subject", json);
25458    if (subject != null)
25459      res.setSubject(subject);
25460    if (json.has("date"))
25461      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25462    if (json.has("_date"))
25463      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25464    if (json.has("publisher"))
25465      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25466    if (json.has("_publisher"))
25467      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
25468    if (json.has("contact")) {
25469      JsonArray array = json.getAsJsonArray("contact");
25470      for (int i = 0; i < array.size(); i++) {
25471        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25472      }
25473    }
25474    ;
25475    if (json.has("description"))
25476      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25477    if (json.has("_description"))
25478      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25479    if (json.has("comment")) {
25480      JsonArray array = json.getAsJsonArray("comment");
25481      for (int i = 0; i < array.size(); i++) {
25482        if (array.get(i).isJsonNull()) {
25483          res.getComment().add(new StringType());
25484        } else {
25485          res.getComment().add(parseString(array.get(i).getAsString()));
25486        }
25487      }
25488    }
25489    ;
25490    if (json.has("_comment")) {
25491      JsonArray array = json.getAsJsonArray("_comment");
25492      for (int i = 0; i < array.size(); i++) {
25493        if (i == res.getComment().size())
25494          res.getComment().add(parseString(null));
25495        if (array.get(i) instanceof JsonObject)
25496          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
25497      }
25498    }
25499    ;
25500    if (json.has("useContext")) {
25501      JsonArray array = json.getAsJsonArray("useContext");
25502      for (int i = 0; i < array.size(); i++) {
25503        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25504      }
25505    }
25506    ;
25507    if (json.has("jurisdiction")) {
25508      JsonArray array = json.getAsJsonArray("jurisdiction");
25509      for (int i = 0; i < array.size(); i++) {
25510        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25511      }
25512    }
25513    ;
25514    if (json.has("purpose"))
25515      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25516    if (json.has("_purpose"))
25517      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
25518    if (json.has("usage"))
25519      res.setUsageElement(parseString(json.get("usage").getAsString()));
25520    if (json.has("_usage"))
25521      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
25522    if (json.has("copyright"))
25523      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25524    if (json.has("_copyright"))
25525      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
25526    if (json.has("approvalDate"))
25527      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
25528    if (json.has("_approvalDate"))
25529      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
25530    if (json.has("lastReviewDate"))
25531      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
25532    if (json.has("_lastReviewDate"))
25533      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
25534    if (json.has("effectivePeriod"))
25535      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
25536    if (json.has("topic")) {
25537      JsonArray array = json.getAsJsonArray("topic");
25538      for (int i = 0; i < array.size(); i++) {
25539        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25540      }
25541    }
25542    ;
25543    if (json.has("author")) {
25544      JsonArray array = json.getAsJsonArray("author");
25545      for (int i = 0; i < array.size(); i++) {
25546        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
25547      }
25548    }
25549    ;
25550    if (json.has("editor")) {
25551      JsonArray array = json.getAsJsonArray("editor");
25552      for (int i = 0; i < array.size(); i++) {
25553        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
25554      }
25555    }
25556    ;
25557    if (json.has("reviewer")) {
25558      JsonArray array = json.getAsJsonArray("reviewer");
25559      for (int i = 0; i < array.size(); i++) {
25560        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
25561      }
25562    }
25563    ;
25564    if (json.has("endorser")) {
25565      JsonArray array = json.getAsJsonArray("endorser");
25566      for (int i = 0; i < array.size(); i++) {
25567        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
25568      }
25569    }
25570    ;
25571    if (json.has("relatedArtifact")) {
25572      JsonArray array = json.getAsJsonArray("relatedArtifact");
25573      for (int i = 0; i < array.size(); i++) {
25574        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
25575      }
25576    }
25577    ;
25578    if (json.has("library")) {
25579      JsonArray array = json.getAsJsonArray("library");
25580      for (int i = 0; i < array.size(); i++) {
25581        if (array.get(i).isJsonNull()) {
25582          res.getLibrary().add(new CanonicalType());
25583        } else {
25584          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
25585        }
25586      }
25587    }
25588    ;
25589    if (json.has("_library")) {
25590      JsonArray array = json.getAsJsonArray("_library");
25591      for (int i = 0; i < array.size(); i++) {
25592        if (i == res.getLibrary().size())
25593          res.getLibrary().add(parseCanonical(null));
25594        if (array.get(i) instanceof JsonObject)
25595          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
25596      }
25597    }
25598    ;
25599    if (json.has("type"))
25600      res.setTypeElement(
25601          parseEnumeration(json.get("type").getAsString(), ResearchElementDefinition.ResearchElementType.NULL,
25602              new ResearchElementDefinition.ResearchElementTypeEnumFactory()));
25603    if (json.has("_type"))
25604      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
25605    if (json.has("variableType"))
25606      res.setVariableTypeElement(parseEnumeration(json.get("variableType").getAsString(),
25607          ResearchElementDefinition.VariableType.NULL, new ResearchElementDefinition.VariableTypeEnumFactory()));
25608    if (json.has("_variableType"))
25609      parseElementProperties(getJObject(json, "_variableType"), res.getVariableTypeElement());
25610    if (json.has("characteristic")) {
25611      JsonArray array = json.getAsJsonArray("characteristic");
25612      for (int i = 0; i < array.size(); i++) {
25613        res.getCharacteristic().add(parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(
25614            array.get(i).getAsJsonObject(), res));
25615      }
25616    }
25617    ;
25618  }
25619
25620  protected ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(
25621      JsonObject json, ResearchElementDefinition owner) throws IOException, FHIRFormatError {
25622    ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res = new ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent();
25623    parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(json, owner, res);
25624    return res;
25625  }
25626
25627  protected void parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(
25628      JsonObject json, ResearchElementDefinition owner,
25629      ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res)
25630      throws IOException, FHIRFormatError {
25631    parseBackboneElementProperties(json, res);
25632    Type definition = parseType("definition", json);
25633    if (definition != null)
25634      res.setDefinition(definition);
25635    if (json.has("usageContext")) {
25636      JsonArray array = json.getAsJsonArray("usageContext");
25637      for (int i = 0; i < array.size(); i++) {
25638        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25639      }
25640    }
25641    ;
25642    if (json.has("exclude"))
25643      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
25644    if (json.has("_exclude"))
25645      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
25646    if (json.has("unitOfMeasure"))
25647      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
25648    if (json.has("studyEffectiveDescription"))
25649      res.setStudyEffectiveDescriptionElement(parseString(json.get("studyEffectiveDescription").getAsString()));
25650    if (json.has("_studyEffectiveDescription"))
25651      parseElementProperties(getJObject(json, "_studyEffectiveDescription"), res.getStudyEffectiveDescriptionElement());
25652    Type studyEffective = parseType("studyEffective", json);
25653    if (studyEffective != null)
25654      res.setStudyEffective(studyEffective);
25655    if (json.has("studyEffectiveTimeFromStart"))
25656      res.setStudyEffectiveTimeFromStart(parseDuration(getJObject(json, "studyEffectiveTimeFromStart")));
25657    if (json.has("studyEffectiveGroupMeasure"))
25658      res.setStudyEffectiveGroupMeasureElement(parseEnumeration(json.get("studyEffectiveGroupMeasure").getAsString(),
25659          ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
25660    if (json.has("_studyEffectiveGroupMeasure"))
25661      parseElementProperties(getJObject(json, "_studyEffectiveGroupMeasure"),
25662          res.getStudyEffectiveGroupMeasureElement());
25663    if (json.has("participantEffectiveDescription"))
25664      res.setParticipantEffectiveDescriptionElement(
25665          parseString(json.get("participantEffectiveDescription").getAsString()));
25666    if (json.has("_participantEffectiveDescription"))
25667      parseElementProperties(getJObject(json, "_participantEffectiveDescription"),
25668          res.getParticipantEffectiveDescriptionElement());
25669    Type participantEffective = parseType("participantEffective", json);
25670    if (participantEffective != null)
25671      res.setParticipantEffective(participantEffective);
25672    if (json.has("participantEffectiveTimeFromStart"))
25673      res.setParticipantEffectiveTimeFromStart(parseDuration(getJObject(json, "participantEffectiveTimeFromStart")));
25674    if (json.has("participantEffectiveGroupMeasure"))
25675      res.setParticipantEffectiveGroupMeasureElement(
25676          parseEnumeration(json.get("participantEffectiveGroupMeasure").getAsString(),
25677              ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
25678    if (json.has("_participantEffectiveGroupMeasure"))
25679      parseElementProperties(getJObject(json, "_participantEffectiveGroupMeasure"),
25680          res.getParticipantEffectiveGroupMeasureElement());
25681  }
25682
25683  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
25684    ResearchStudy res = new ResearchStudy();
25685    parseResearchStudyProperties(json, res);
25686    return res;
25687  }
25688
25689  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
25690    parseDomainResourceProperties(json, res);
25691    if (json.has("identifier")) {
25692      JsonArray array = json.getAsJsonArray("identifier");
25693      for (int i = 0; i < array.size(); i++) {
25694        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25695      }
25696    }
25697    ;
25698    if (json.has("title"))
25699      res.setTitleElement(parseString(json.get("title").getAsString()));
25700    if (json.has("_title"))
25701      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
25702    if (json.has("protocol")) {
25703      JsonArray array = json.getAsJsonArray("protocol");
25704      for (int i = 0; i < array.size(); i++) {
25705        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
25706      }
25707    }
25708    ;
25709    if (json.has("partOf")) {
25710      JsonArray array = json.getAsJsonArray("partOf");
25711      for (int i = 0; i < array.size(); i++) {
25712        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25713      }
25714    }
25715    ;
25716    if (json.has("status"))
25717      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL,
25718          new ResearchStudy.ResearchStudyStatusEnumFactory()));
25719    if (json.has("_status"))
25720      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25721    if (json.has("primaryPurposeType"))
25722      res.setPrimaryPurposeType(parseCodeableConcept(getJObject(json, "primaryPurposeType")));
25723    if (json.has("phase"))
25724      res.setPhase(parseCodeableConcept(getJObject(json, "phase")));
25725    if (json.has("category")) {
25726      JsonArray array = json.getAsJsonArray("category");
25727      for (int i = 0; i < array.size(); i++) {
25728        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25729      }
25730    }
25731    ;
25732    if (json.has("focus")) {
25733      JsonArray array = json.getAsJsonArray("focus");
25734      for (int i = 0; i < array.size(); i++) {
25735        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25736      }
25737    }
25738    ;
25739    if (json.has("condition")) {
25740      JsonArray array = json.getAsJsonArray("condition");
25741      for (int i = 0; i < array.size(); i++) {
25742        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25743      }
25744    }
25745    ;
25746    if (json.has("contact")) {
25747      JsonArray array = json.getAsJsonArray("contact");
25748      for (int i = 0; i < array.size(); i++) {
25749        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25750      }
25751    }
25752    ;
25753    if (json.has("relatedArtifact")) {
25754      JsonArray array = json.getAsJsonArray("relatedArtifact");
25755      for (int i = 0; i < array.size(); i++) {
25756        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
25757      }
25758    }
25759    ;
25760    if (json.has("keyword")) {
25761      JsonArray array = json.getAsJsonArray("keyword");
25762      for (int i = 0; i < array.size(); i++) {
25763        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25764      }
25765    }
25766    ;
25767    if (json.has("location")) {
25768      JsonArray array = json.getAsJsonArray("location");
25769      for (int i = 0; i < array.size(); i++) {
25770        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25771      }
25772    }
25773    ;
25774    if (json.has("description"))
25775      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25776    if (json.has("_description"))
25777      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25778    if (json.has("enrollment")) {
25779      JsonArray array = json.getAsJsonArray("enrollment");
25780      for (int i = 0; i < array.size(); i++) {
25781        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
25782      }
25783    }
25784    ;
25785    if (json.has("period"))
25786      res.setPeriod(parsePeriod(getJObject(json, "period")));
25787    if (json.has("sponsor"))
25788      res.setSponsor(parseReference(getJObject(json, "sponsor")));
25789    if (json.has("principalInvestigator"))
25790      res.setPrincipalInvestigator(parseReference(getJObject(json, "principalInvestigator")));
25791    if (json.has("site")) {
25792      JsonArray array = json.getAsJsonArray("site");
25793      for (int i = 0; i < array.size(); i++) {
25794        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
25795      }
25796    }
25797    ;
25798    if (json.has("reasonStopped"))
25799      res.setReasonStopped(parseCodeableConcept(getJObject(json, "reasonStopped")));
25800    if (json.has("note")) {
25801      JsonArray array = json.getAsJsonArray("note");
25802      for (int i = 0; i < array.size(); i++) {
25803        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25804      }
25805    }
25806    ;
25807    if (json.has("arm")) {
25808      JsonArray array = json.getAsJsonArray("arm");
25809      for (int i = 0; i < array.size(); i++) {
25810        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
25811      }
25812    }
25813    ;
25814    if (json.has("objective")) {
25815      JsonArray array = json.getAsJsonArray("objective");
25816      for (int i = 0; i < array.size(); i++) {
25817        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
25818      }
25819    }
25820    ;
25821  }
25822
25823  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json,
25824      ResearchStudy owner) throws IOException, FHIRFormatError {
25825    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
25826    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
25827    return res;
25828  }
25829
25830  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner,
25831      ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
25832    parseBackboneElementProperties(json, res);
25833    if (json.has("name"))
25834      res.setNameElement(parseString(json.get("name").getAsString()));
25835    if (json.has("_name"))
25836      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25837    if (json.has("type"))
25838      res.setType(parseCodeableConcept(getJObject(json, "type")));
25839    if (json.has("description"))
25840      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25841    if (json.has("_description"))
25842      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25843  }
25844
25845  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(
25846      JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
25847    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
25848    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
25849    return res;
25850  }
25851
25852  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner,
25853      ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
25854    parseBackboneElementProperties(json, res);
25855    if (json.has("name"))
25856      res.setNameElement(parseString(json.get("name").getAsString()));
25857    if (json.has("_name"))
25858      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25859    if (json.has("type"))
25860      res.setType(parseCodeableConcept(getJObject(json, "type")));
25861  }
25862
25863  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
25864    ResearchSubject res = new ResearchSubject();
25865    parseResearchSubjectProperties(json, res);
25866    return res;
25867  }
25868
25869  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res)
25870      throws IOException, FHIRFormatError {
25871    parseDomainResourceProperties(json, res);
25872    if (json.has("identifier")) {
25873      JsonArray array = json.getAsJsonArray("identifier");
25874      for (int i = 0; i < array.size(); i++) {
25875        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25876      }
25877    }
25878    ;
25879    if (json.has("status"))
25880      res.setStatusElement(parseEnumeration(json.get("status").getAsString(),
25881          ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
25882    if (json.has("_status"))
25883      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25884    if (json.has("period"))
25885      res.setPeriod(parsePeriod(getJObject(json, "period")));
25886    if (json.has("study"))
25887      res.setStudy(parseReference(getJObject(json, "study")));
25888    if (json.has("individual"))
25889      res.setIndividual(parseReference(getJObject(json, "individual")));
25890    if (json.has("assignedArm"))
25891      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
25892    if (json.has("_assignedArm"))
25893      parseElementProperties(getJObject(json, "_assignedArm"), res.getAssignedArmElement());
25894    if (json.has("actualArm"))
25895      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
25896    if (json.has("_actualArm"))
25897      parseElementProperties(getJObject(json, "_actualArm"), res.getActualArmElement());
25898    if (json.has("consent"))
25899      res.setConsent(parseReference(getJObject(json, "consent")));
25900  }
25901
25902  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
25903    RiskAssessment res = new RiskAssessment();
25904    parseRiskAssessmentProperties(json, res);
25905    return res;
25906  }
25907
25908  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res)
25909      throws IOException, FHIRFormatError {
25910    parseDomainResourceProperties(json, res);
25911    if (json.has("identifier")) {
25912      JsonArray array = json.getAsJsonArray("identifier");
25913      for (int i = 0; i < array.size(); i++) {
25914        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25915      }
25916    }
25917    ;
25918    if (json.has("basedOn"))
25919      res.setBasedOn(parseReference(getJObject(json, "basedOn")));
25920    if (json.has("parent"))
25921      res.setParent(parseReference(getJObject(json, "parent")));
25922    if (json.has("status"))
25923      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL,
25924          new RiskAssessment.RiskAssessmentStatusEnumFactory()));
25925    if (json.has("_status"))
25926      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25927    if (json.has("method"))
25928      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
25929    if (json.has("code"))
25930      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25931    if (json.has("subject"))
25932      res.setSubject(parseReference(getJObject(json, "subject")));
25933    if (json.has("encounter"))
25934      res.setEncounter(parseReference(getJObject(json, "encounter")));
25935    Type occurrence = parseType("occurrence", json);
25936    if (occurrence != null)
25937      res.setOccurrence(occurrence);
25938    if (json.has("condition"))
25939      res.setCondition(parseReference(getJObject(json, "condition")));
25940    if (json.has("performer"))
25941      res.setPerformer(parseReference(getJObject(json, "performer")));
25942    if (json.has("reasonCode")) {
25943      JsonArray array = json.getAsJsonArray("reasonCode");
25944      for (int i = 0; i < array.size(); i++) {
25945        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25946      }
25947    }
25948    ;
25949    if (json.has("reasonReference")) {
25950      JsonArray array = json.getAsJsonArray("reasonReference");
25951      for (int i = 0; i < array.size(); i++) {
25952        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
25953      }
25954    }
25955    ;
25956    if (json.has("basis")) {
25957      JsonArray array = json.getAsJsonArray("basis");
25958      for (int i = 0; i < array.size(); i++) {
25959        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
25960      }
25961    }
25962    ;
25963    if (json.has("prediction")) {
25964      JsonArray array = json.getAsJsonArray("prediction");
25965      for (int i = 0; i < array.size(); i++) {
25966        res.getPrediction()
25967            .add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
25968      }
25969    }
25970    ;
25971    if (json.has("mitigation"))
25972      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
25973    if (json.has("_mitigation"))
25974      parseElementProperties(getJObject(json, "_mitigation"), res.getMitigationElement());
25975    if (json.has("note")) {
25976      JsonArray array = json.getAsJsonArray("note");
25977      for (int i = 0; i < array.size(); i++) {
25978        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25979      }
25980    }
25981    ;
25982  }
25983
25984  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(
25985      JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
25986    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
25987    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
25988    return res;
25989  }
25990
25991  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner,
25992      RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
25993    parseBackboneElementProperties(json, res);
25994    if (json.has("outcome"))
25995      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
25996    Type probability = parseType("probability", json);
25997    if (probability != null)
25998      res.setProbability(probability);
25999    if (json.has("qualitativeRisk"))
26000      res.setQualitativeRisk(parseCodeableConcept(getJObject(json, "qualitativeRisk")));
26001    if (json.has("relativeRisk"))
26002      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
26003    if (json.has("_relativeRisk"))
26004      parseElementProperties(getJObject(json, "_relativeRisk"), res.getRelativeRiskElement());
26005    Type when = parseType("when", json);
26006    if (when != null)
26007      res.setWhen(when);
26008    if (json.has("rationale"))
26009      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
26010    if (json.has("_rationale"))
26011      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
26012  }
26013
26014  protected RiskEvidenceSynthesis parseRiskEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
26015    RiskEvidenceSynthesis res = new RiskEvidenceSynthesis();
26016    parseRiskEvidenceSynthesisProperties(json, res);
26017    return res;
26018  }
26019
26020  protected void parseRiskEvidenceSynthesisProperties(JsonObject json, RiskEvidenceSynthesis res)
26021      throws IOException, FHIRFormatError {
26022    parseDomainResourceProperties(json, res);
26023    if (json.has("url"))
26024      res.setUrlElement(parseUri(json.get("url").getAsString()));
26025    if (json.has("_url"))
26026      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26027    if (json.has("identifier")) {
26028      JsonArray array = json.getAsJsonArray("identifier");
26029      for (int i = 0; i < array.size(); i++) {
26030        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26031      }
26032    }
26033    ;
26034    if (json.has("version"))
26035      res.setVersionElement(parseString(json.get("version").getAsString()));
26036    if (json.has("_version"))
26037      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26038    if (json.has("name"))
26039      res.setNameElement(parseString(json.get("name").getAsString()));
26040    if (json.has("_name"))
26041      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26042    if (json.has("title"))
26043      res.setTitleElement(parseString(json.get("title").getAsString()));
26044    if (json.has("_title"))
26045      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26046    if (json.has("status"))
26047      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
26048          new Enumerations.PublicationStatusEnumFactory()));
26049    if (json.has("_status"))
26050      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26051    if (json.has("date"))
26052      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26053    if (json.has("_date"))
26054      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26055    if (json.has("publisher"))
26056      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26057    if (json.has("_publisher"))
26058      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26059    if (json.has("contact")) {
26060      JsonArray array = json.getAsJsonArray("contact");
26061      for (int i = 0; i < array.size(); i++) {
26062        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26063      }
26064    }
26065    ;
26066    if (json.has("description"))
26067      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26068    if (json.has("_description"))
26069      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26070    if (json.has("note")) {
26071      JsonArray array = json.getAsJsonArray("note");
26072      for (int i = 0; i < array.size(); i++) {
26073        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26074      }
26075    }
26076    ;
26077    if (json.has("useContext")) {
26078      JsonArray array = json.getAsJsonArray("useContext");
26079      for (int i = 0; i < array.size(); i++) {
26080        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26081      }
26082    }
26083    ;
26084    if (json.has("jurisdiction")) {
26085      JsonArray array = json.getAsJsonArray("jurisdiction");
26086      for (int i = 0; i < array.size(); i++) {
26087        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26088      }
26089    }
26090    ;
26091    if (json.has("copyright"))
26092      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26093    if (json.has("_copyright"))
26094      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
26095    if (json.has("approvalDate"))
26096      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
26097    if (json.has("_approvalDate"))
26098      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
26099    if (json.has("lastReviewDate"))
26100      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
26101    if (json.has("_lastReviewDate"))
26102      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
26103    if (json.has("effectivePeriod"))
26104      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
26105    if (json.has("topic")) {
26106      JsonArray array = json.getAsJsonArray("topic");
26107      for (int i = 0; i < array.size(); i++) {
26108        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26109      }
26110    }
26111    ;
26112    if (json.has("author")) {
26113      JsonArray array = json.getAsJsonArray("author");
26114      for (int i = 0; i < array.size(); i++) {
26115        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
26116      }
26117    }
26118    ;
26119    if (json.has("editor")) {
26120      JsonArray array = json.getAsJsonArray("editor");
26121      for (int i = 0; i < array.size(); i++) {
26122        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
26123      }
26124    }
26125    ;
26126    if (json.has("reviewer")) {
26127      JsonArray array = json.getAsJsonArray("reviewer");
26128      for (int i = 0; i < array.size(); i++) {
26129        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
26130      }
26131    }
26132    ;
26133    if (json.has("endorser")) {
26134      JsonArray array = json.getAsJsonArray("endorser");
26135      for (int i = 0; i < array.size(); i++) {
26136        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
26137      }
26138    }
26139    ;
26140    if (json.has("relatedArtifact")) {
26141      JsonArray array = json.getAsJsonArray("relatedArtifact");
26142      for (int i = 0; i < array.size(); i++) {
26143        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
26144      }
26145    }
26146    ;
26147    if (json.has("synthesisType"))
26148      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
26149    if (json.has("studyType"))
26150      res.setStudyType(parseCodeableConcept(getJObject(json, "studyType")));
26151    if (json.has("population"))
26152      res.setPopulation(parseReference(getJObject(json, "population")));
26153    if (json.has("exposure"))
26154      res.setExposure(parseReference(getJObject(json, "exposure")));
26155    if (json.has("outcome"))
26156      res.setOutcome(parseReference(getJObject(json, "outcome")));
26157    if (json.has("sampleSize"))
26158      res.setSampleSize(
26159          parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(getJObject(json, "sampleSize"), res));
26160    if (json.has("riskEstimate"))
26161      res.setRiskEstimate(
26162          parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(getJObject(json, "riskEstimate"), res));
26163    if (json.has("certainty")) {
26164      JsonArray array = json.getAsJsonArray("certainty");
26165      for (int i = 0; i < array.size(); i++) {
26166        res.getCertainty().add(
26167            parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
26168      }
26169    }
26170    ;
26171  }
26172
26173  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(
26174      JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
26175    RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent();
26176    parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
26177    return res;
26178  }
26179
26180  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(JsonObject json,
26181      RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res)
26182      throws IOException, FHIRFormatError {
26183    parseBackboneElementProperties(json, res);
26184    if (json.has("description"))
26185      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26186    if (json.has("_description"))
26187      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26188    if (json.has("numberOfStudies"))
26189      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
26190    if (json.has("_numberOfStudies"))
26191      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
26192    if (json.has("numberOfParticipants"))
26193      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
26194    if (json.has("_numberOfParticipants"))
26195      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
26196  }
26197
26198  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(
26199      JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
26200    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent();
26201    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(json, owner, res);
26202    return res;
26203  }
26204
26205  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(JsonObject json,
26206      RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res)
26207      throws IOException, FHIRFormatError {
26208    parseBackboneElementProperties(json, res);
26209    if (json.has("description"))
26210      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26211    if (json.has("_description"))
26212      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26213    if (json.has("type"))
26214      res.setType(parseCodeableConcept(getJObject(json, "type")));
26215    if (json.has("value"))
26216      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
26217    if (json.has("_value"))
26218      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
26219    if (json.has("unitOfMeasure"))
26220      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
26221    if (json.has("denominatorCount"))
26222      res.setDenominatorCountElement(parseInteger(json.get("denominatorCount").getAsLong()));
26223    if (json.has("_denominatorCount"))
26224      parseElementProperties(getJObject(json, "_denominatorCount"), res.getDenominatorCountElement());
26225    if (json.has("numeratorCount"))
26226      res.setNumeratorCountElement(parseInteger(json.get("numeratorCount").getAsLong()));
26227    if (json.has("_numeratorCount"))
26228      parseElementProperties(getJObject(json, "_numeratorCount"), res.getNumeratorCountElement());
26229    if (json.has("precisionEstimate")) {
26230      JsonArray array = json.getAsJsonArray("precisionEstimate");
26231      for (int i = 0; i < array.size(); i++) {
26232        res.getPrecisionEstimate()
26233            .add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(
26234                array.get(i).getAsJsonObject(), owner));
26235      }
26236    }
26237    ;
26238  }
26239
26240  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(
26241      JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
26242    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent();
26243    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(json, owner, res);
26244    return res;
26245  }
26246
26247  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(
26248      JsonObject json, RiskEvidenceSynthesis owner,
26249      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res)
26250      throws IOException, FHIRFormatError {
26251    parseBackboneElementProperties(json, res);
26252    if (json.has("type"))
26253      res.setType(parseCodeableConcept(getJObject(json, "type")));
26254    if (json.has("level"))
26255      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
26256    if (json.has("_level"))
26257      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
26258    if (json.has("from"))
26259      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
26260    if (json.has("_from"))
26261      parseElementProperties(getJObject(json, "_from"), res.getFromElement());
26262    if (json.has("to"))
26263      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
26264    if (json.has("_to"))
26265      parseElementProperties(getJObject(json, "_to"), res.getToElement());
26266  }
26267
26268  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(
26269      JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
26270    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent();
26271    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
26272    return res;
26273  }
26274
26275  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(JsonObject json,
26276      RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res)
26277      throws IOException, FHIRFormatError {
26278    parseBackboneElementProperties(json, res);
26279    if (json.has("rating")) {
26280      JsonArray array = json.getAsJsonArray("rating");
26281      for (int i = 0; i < array.size(); i++) {
26282        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26283      }
26284    }
26285    ;
26286    if (json.has("note")) {
26287      JsonArray array = json.getAsJsonArray("note");
26288      for (int i = 0; i < array.size(); i++) {
26289        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26290      }
26291    }
26292    ;
26293    if (json.has("certaintySubcomponent")) {
26294      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
26295      for (int i = 0; i < array.size(); i++) {
26296        res.getCertaintySubcomponent()
26297            .add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
26298                array.get(i).getAsJsonObject(), owner));
26299      }
26300    }
26301    ;
26302  }
26303
26304  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
26305      JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
26306    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
26307    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
26308    return res;
26309  }
26310
26311  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(
26312      JsonObject json, RiskEvidenceSynthesis owner,
26313      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res)
26314      throws IOException, FHIRFormatError {
26315    parseBackboneElementProperties(json, res);
26316    if (json.has("type"))
26317      res.setType(parseCodeableConcept(getJObject(json, "type")));
26318    if (json.has("rating")) {
26319      JsonArray array = json.getAsJsonArray("rating");
26320      for (int i = 0; i < array.size(); i++) {
26321        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26322      }
26323    }
26324    ;
26325    if (json.has("note")) {
26326      JsonArray array = json.getAsJsonArray("note");
26327      for (int i = 0; i < array.size(); i++) {
26328        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26329      }
26330    }
26331    ;
26332  }
26333
26334  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
26335    Schedule res = new Schedule();
26336    parseScheduleProperties(json, res);
26337    return res;
26338  }
26339
26340  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
26341    parseDomainResourceProperties(json, res);
26342    if (json.has("identifier")) {
26343      JsonArray array = json.getAsJsonArray("identifier");
26344      for (int i = 0; i < array.size(); i++) {
26345        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26346      }
26347    }
26348    ;
26349    if (json.has("active"))
26350      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
26351    if (json.has("_active"))
26352      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
26353    if (json.has("serviceCategory")) {
26354      JsonArray array = json.getAsJsonArray("serviceCategory");
26355      for (int i = 0; i < array.size(); i++) {
26356        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26357      }
26358    }
26359    ;
26360    if (json.has("serviceType")) {
26361      JsonArray array = json.getAsJsonArray("serviceType");
26362      for (int i = 0; i < array.size(); i++) {
26363        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26364      }
26365    }
26366    ;
26367    if (json.has("specialty")) {
26368      JsonArray array = json.getAsJsonArray("specialty");
26369      for (int i = 0; i < array.size(); i++) {
26370        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26371      }
26372    }
26373    ;
26374    if (json.has("actor")) {
26375      JsonArray array = json.getAsJsonArray("actor");
26376      for (int i = 0; i < array.size(); i++) {
26377        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
26378      }
26379    }
26380    ;
26381    if (json.has("planningHorizon"))
26382      res.setPlanningHorizon(parsePeriod(getJObject(json, "planningHorizon")));
26383    if (json.has("comment"))
26384      res.setCommentElement(parseString(json.get("comment").getAsString()));
26385    if (json.has("_comment"))
26386      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
26387  }
26388
26389  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
26390    SearchParameter res = new SearchParameter();
26391    parseSearchParameterProperties(json, res);
26392    return res;
26393  }
26394
26395  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res)
26396      throws IOException, FHIRFormatError {
26397    parseDomainResourceProperties(json, res);
26398    if (json.has("url"))
26399      res.setUrlElement(parseUri(json.get("url").getAsString()));
26400    if (json.has("_url"))
26401      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26402    if (json.has("version"))
26403      res.setVersionElement(parseString(json.get("version").getAsString()));
26404    if (json.has("_version"))
26405      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26406    if (json.has("name"))
26407      res.setNameElement(parseString(json.get("name").getAsString()));
26408    if (json.has("_name"))
26409      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26410    if (json.has("derivedFrom"))
26411      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
26412    if (json.has("_derivedFrom"))
26413      parseElementProperties(getJObject(json, "_derivedFrom"), res.getDerivedFromElement());
26414    if (json.has("status"))
26415      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
26416          new Enumerations.PublicationStatusEnumFactory()));
26417    if (json.has("_status"))
26418      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26419    if (json.has("experimental"))
26420      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26421    if (json.has("_experimental"))
26422      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
26423    if (json.has("date"))
26424      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26425    if (json.has("_date"))
26426      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26427    if (json.has("publisher"))
26428      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26429    if (json.has("_publisher"))
26430      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26431    if (json.has("contact")) {
26432      JsonArray array = json.getAsJsonArray("contact");
26433      for (int i = 0; i < array.size(); i++) {
26434        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26435      }
26436    }
26437    ;
26438    if (json.has("description"))
26439      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26440    if (json.has("_description"))
26441      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26442    if (json.has("useContext")) {
26443      JsonArray array = json.getAsJsonArray("useContext");
26444      for (int i = 0; i < array.size(); i++) {
26445        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26446      }
26447    }
26448    ;
26449    if (json.has("jurisdiction")) {
26450      JsonArray array = json.getAsJsonArray("jurisdiction");
26451      for (int i = 0; i < array.size(); i++) {
26452        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26453      }
26454    }
26455    ;
26456    if (json.has("purpose"))
26457      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26458    if (json.has("_purpose"))
26459      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
26460    if (json.has("code"))
26461      res.setCodeElement(parseCode(json.get("code").getAsString()));
26462    if (json.has("_code"))
26463      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
26464    if (json.has("base")) {
26465      JsonArray array = json.getAsJsonArray("base");
26466      for (int i = 0; i < array.size(); i++) {
26467        if (array.get(i).isJsonNull()) {
26468          res.getBase().add(new CodeType());
26469        } else {
26470          res.getBase().add(parseCode(array.get(i).getAsString()));
26471        }
26472      }
26473    }
26474    ;
26475    if (json.has("_base")) {
26476      JsonArray array = json.getAsJsonArray("_base");
26477      for (int i = 0; i < array.size(); i++) {
26478        if (i == res.getBase().size())
26479          res.getBase().add(parseCode(null));
26480        if (array.get(i) instanceof JsonObject)
26481          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
26482      }
26483    }
26484    ;
26485    if (json.has("type"))
26486      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL,
26487          new Enumerations.SearchParamTypeEnumFactory()));
26488    if (json.has("_type"))
26489      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
26490    if (json.has("expression"))
26491      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26492    if (json.has("_expression"))
26493      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
26494    if (json.has("xpath"))
26495      res.setXpathElement(parseString(json.get("xpath").getAsString()));
26496    if (json.has("_xpath"))
26497      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
26498    if (json.has("xpathUsage"))
26499      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(),
26500          SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
26501    if (json.has("_xpathUsage"))
26502      parseElementProperties(getJObject(json, "_xpathUsage"), res.getXpathUsageElement());
26503    if (json.has("target")) {
26504      JsonArray array = json.getAsJsonArray("target");
26505      for (int i = 0; i < array.size(); i++) {
26506        if (array.get(i).isJsonNull()) {
26507          res.getTarget().add(new CodeType());
26508        } else {
26509          res.getTarget().add(parseCode(array.get(i).getAsString()));
26510        }
26511      }
26512    }
26513    ;
26514    if (json.has("_target")) {
26515      JsonArray array = json.getAsJsonArray("_target");
26516      for (int i = 0; i < array.size(); i++) {
26517        if (i == res.getTarget().size())
26518          res.getTarget().add(parseCode(null));
26519        if (array.get(i) instanceof JsonObject)
26520          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
26521      }
26522    }
26523    ;
26524    if (json.has("multipleOr"))
26525      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
26526    if (json.has("_multipleOr"))
26527      parseElementProperties(getJObject(json, "_multipleOr"), res.getMultipleOrElement());
26528    if (json.has("multipleAnd"))
26529      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
26530    if (json.has("_multipleAnd"))
26531      parseElementProperties(getJObject(json, "_multipleAnd"), res.getMultipleAndElement());
26532    if (json.has("comparator")) {
26533      JsonArray array = json.getAsJsonArray("comparator");
26534      for (int i = 0; i < array.size(); i++) {
26535        if (array.get(i).isJsonNull()) {
26536          res.getComparator().add(new Enumeration<SearchParameter.SearchComparator>());
26537        } else {
26538          res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL,
26539              new SearchParameter.SearchComparatorEnumFactory()));
26540        }
26541      }
26542    }
26543    ;
26544    if (json.has("_comparator")) {
26545      JsonArray array = json.getAsJsonArray("_comparator");
26546      for (int i = 0; i < array.size(); i++) {
26547        if (i == res.getComparator().size())
26548          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL,
26549              new SearchParameter.SearchComparatorEnumFactory()));
26550        if (array.get(i) instanceof JsonObject)
26551          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
26552      }
26553    }
26554    ;
26555    if (json.has("modifier")) {
26556      JsonArray array = json.getAsJsonArray("modifier");
26557      for (int i = 0; i < array.size(); i++) {
26558        if (array.get(i).isJsonNull()) {
26559          res.getModifier().add(new Enumeration<SearchParameter.SearchModifierCode>());
26560        } else {
26561          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL,
26562              new SearchParameter.SearchModifierCodeEnumFactory()));
26563        }
26564      }
26565    }
26566    ;
26567    if (json.has("_modifier")) {
26568      JsonArray array = json.getAsJsonArray("_modifier");
26569      for (int i = 0; i < array.size(); i++) {
26570        if (i == res.getModifier().size())
26571          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL,
26572              new SearchParameter.SearchModifierCodeEnumFactory()));
26573        if (array.get(i) instanceof JsonObject)
26574          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
26575      }
26576    }
26577    ;
26578    if (json.has("chain")) {
26579      JsonArray array = json.getAsJsonArray("chain");
26580      for (int i = 0; i < array.size(); i++) {
26581        if (array.get(i).isJsonNull()) {
26582          res.getChain().add(new StringType());
26583        } else {
26584          res.getChain().add(parseString(array.get(i).getAsString()));
26585        }
26586      }
26587    }
26588    ;
26589    if (json.has("_chain")) {
26590      JsonArray array = json.getAsJsonArray("_chain");
26591      for (int i = 0; i < array.size(); i++) {
26592        if (i == res.getChain().size())
26593          res.getChain().add(parseString(null));
26594        if (array.get(i) instanceof JsonObject)
26595          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
26596      }
26597    }
26598    ;
26599    if (json.has("component")) {
26600      JsonArray array = json.getAsJsonArray("component");
26601      for (int i = 0; i < array.size(); i++) {
26602        res.getComponent()
26603            .add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
26604      }
26605    }
26606    ;
26607  }
26608
26609  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(
26610      JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
26611    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
26612    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
26613    return res;
26614  }
26615
26616  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner,
26617      SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
26618    parseBackboneElementProperties(json, res);
26619    if (json.has("definition"))
26620      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
26621    if (json.has("_definition"))
26622      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
26623    if (json.has("expression"))
26624      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26625    if (json.has("_expression"))
26626      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
26627  }
26628
26629  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
26630    ServiceRequest res = new ServiceRequest();
26631    parseServiceRequestProperties(json, res);
26632    return res;
26633  }
26634
26635  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res)
26636      throws IOException, FHIRFormatError {
26637    parseDomainResourceProperties(json, res);
26638    if (json.has("identifier")) {
26639      JsonArray array = json.getAsJsonArray("identifier");
26640      for (int i = 0; i < array.size(); i++) {
26641        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26642      }
26643    }
26644    ;
26645    if (json.has("instantiatesCanonical")) {
26646      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
26647      for (int i = 0; i < array.size(); i++) {
26648        if (array.get(i).isJsonNull()) {
26649          res.getInstantiatesCanonical().add(new CanonicalType());
26650        } else {
26651          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
26652        }
26653      }
26654    }
26655    ;
26656    if (json.has("_instantiatesCanonical")) {
26657      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
26658      for (int i = 0; i < array.size(); i++) {
26659        if (i == res.getInstantiatesCanonical().size())
26660          res.getInstantiatesCanonical().add(parseCanonical(null));
26661        if (array.get(i) instanceof JsonObject)
26662          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
26663      }
26664    }
26665    ;
26666    if (json.has("instantiatesUri")) {
26667      JsonArray array = json.getAsJsonArray("instantiatesUri");
26668      for (int i = 0; i < array.size(); i++) {
26669        if (array.get(i).isJsonNull()) {
26670          res.getInstantiatesUri().add(new UriType());
26671        } else {
26672          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
26673        }
26674      }
26675    }
26676    ;
26677    if (json.has("_instantiatesUri")) {
26678      JsonArray array = json.getAsJsonArray("_instantiatesUri");
26679      for (int i = 0; i < array.size(); i++) {
26680        if (i == res.getInstantiatesUri().size())
26681          res.getInstantiatesUri().add(parseUri(null));
26682        if (array.get(i) instanceof JsonObject)
26683          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
26684      }
26685    }
26686    ;
26687    if (json.has("basedOn")) {
26688      JsonArray array = json.getAsJsonArray("basedOn");
26689      for (int i = 0; i < array.size(); i++) {
26690        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
26691      }
26692    }
26693    ;
26694    if (json.has("replaces")) {
26695      JsonArray array = json.getAsJsonArray("replaces");
26696      for (int i = 0; i < array.size(); i++) {
26697        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
26698      }
26699    }
26700    ;
26701    if (json.has("requisition"))
26702      res.setRequisition(parseIdentifier(getJObject(json, "requisition")));
26703    if (json.has("status"))
26704      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL,
26705          new ServiceRequest.ServiceRequestStatusEnumFactory()));
26706    if (json.has("_status"))
26707      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26708    if (json.has("intent"))
26709      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL,
26710          new ServiceRequest.ServiceRequestIntentEnumFactory()));
26711    if (json.has("_intent"))
26712      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
26713    if (json.has("category")) {
26714      JsonArray array = json.getAsJsonArray("category");
26715      for (int i = 0; i < array.size(); i++) {
26716        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26717      }
26718    }
26719    ;
26720    if (json.has("priority"))
26721      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(),
26722          ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
26723    if (json.has("_priority"))
26724      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
26725    if (json.has("doNotPerform"))
26726      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
26727    if (json.has("_doNotPerform"))
26728      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
26729    if (json.has("code"))
26730      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26731    if (json.has("orderDetail")) {
26732      JsonArray array = json.getAsJsonArray("orderDetail");
26733      for (int i = 0; i < array.size(); i++) {
26734        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26735      }
26736    }
26737    ;
26738    Type quantity = parseType("quantity", json);
26739    if (quantity != null)
26740      res.setQuantity(quantity);
26741    if (json.has("subject"))
26742      res.setSubject(parseReference(getJObject(json, "subject")));
26743    if (json.has("encounter"))
26744      res.setEncounter(parseReference(getJObject(json, "encounter")));
26745    Type occurrence = parseType("occurrence", json);
26746    if (occurrence != null)
26747      res.setOccurrence(occurrence);
26748    Type asNeeded = parseType("asNeeded", json);
26749    if (asNeeded != null)
26750      res.setAsNeeded(asNeeded);
26751    if (json.has("authoredOn"))
26752      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
26753    if (json.has("_authoredOn"))
26754      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
26755    if (json.has("requester"))
26756      res.setRequester(parseReference(getJObject(json, "requester")));
26757    if (json.has("performerType"))
26758      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
26759    if (json.has("performer")) {
26760      JsonArray array = json.getAsJsonArray("performer");
26761      for (int i = 0; i < array.size(); i++) {
26762        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
26763      }
26764    }
26765    ;
26766    if (json.has("locationCode")) {
26767      JsonArray array = json.getAsJsonArray("locationCode");
26768      for (int i = 0; i < array.size(); i++) {
26769        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26770      }
26771    }
26772    ;
26773    if (json.has("locationReference")) {
26774      JsonArray array = json.getAsJsonArray("locationReference");
26775      for (int i = 0; i < array.size(); i++) {
26776        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
26777      }
26778    }
26779    ;
26780    if (json.has("reasonCode")) {
26781      JsonArray array = json.getAsJsonArray("reasonCode");
26782      for (int i = 0; i < array.size(); i++) {
26783        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26784      }
26785    }
26786    ;
26787    if (json.has("reasonReference")) {
26788      JsonArray array = json.getAsJsonArray("reasonReference");
26789      for (int i = 0; i < array.size(); i++) {
26790        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
26791      }
26792    }
26793    ;
26794    if (json.has("insurance")) {
26795      JsonArray array = json.getAsJsonArray("insurance");
26796      for (int i = 0; i < array.size(); i++) {
26797        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
26798      }
26799    }
26800    ;
26801    if (json.has("supportingInfo")) {
26802      JsonArray array = json.getAsJsonArray("supportingInfo");
26803      for (int i = 0; i < array.size(); i++) {
26804        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
26805      }
26806    }
26807    ;
26808    if (json.has("specimen")) {
26809      JsonArray array = json.getAsJsonArray("specimen");
26810      for (int i = 0; i < array.size(); i++) {
26811        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
26812      }
26813    }
26814    ;
26815    if (json.has("bodySite")) {
26816      JsonArray array = json.getAsJsonArray("bodySite");
26817      for (int i = 0; i < array.size(); i++) {
26818        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26819      }
26820    }
26821    ;
26822    if (json.has("note")) {
26823      JsonArray array = json.getAsJsonArray("note");
26824      for (int i = 0; i < array.size(); i++) {
26825        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26826      }
26827    }
26828    ;
26829    if (json.has("patientInstruction"))
26830      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
26831    if (json.has("_patientInstruction"))
26832      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
26833    if (json.has("relevantHistory")) {
26834      JsonArray array = json.getAsJsonArray("relevantHistory");
26835      for (int i = 0; i < array.size(); i++) {
26836        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
26837      }
26838    }
26839    ;
26840  }
26841
26842  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
26843    Slot res = new Slot();
26844    parseSlotProperties(json, res);
26845    return res;
26846  }
26847
26848  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
26849    parseDomainResourceProperties(json, res);
26850    if (json.has("identifier")) {
26851      JsonArray array = json.getAsJsonArray("identifier");
26852      for (int i = 0; i < array.size(); i++) {
26853        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26854      }
26855    }
26856    ;
26857    if (json.has("serviceCategory")) {
26858      JsonArray array = json.getAsJsonArray("serviceCategory");
26859      for (int i = 0; i < array.size(); i++) {
26860        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26861      }
26862    }
26863    ;
26864    if (json.has("serviceType")) {
26865      JsonArray array = json.getAsJsonArray("serviceType");
26866      for (int i = 0; i < array.size(); i++) {
26867        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26868      }
26869    }
26870    ;
26871    if (json.has("specialty")) {
26872      JsonArray array = json.getAsJsonArray("specialty");
26873      for (int i = 0; i < array.size(); i++) {
26874        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26875      }
26876    }
26877    ;
26878    if (json.has("appointmentType"))
26879      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
26880    if (json.has("schedule"))
26881      res.setSchedule(parseReference(getJObject(json, "schedule")));
26882    if (json.has("status"))
26883      res.setStatusElement(
26884          parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
26885    if (json.has("_status"))
26886      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26887    if (json.has("start"))
26888      res.setStartElement(parseInstant(json.get("start").getAsString()));
26889    if (json.has("_start"))
26890      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
26891    if (json.has("end"))
26892      res.setEndElement(parseInstant(json.get("end").getAsString()));
26893    if (json.has("_end"))
26894      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
26895    if (json.has("overbooked"))
26896      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
26897    if (json.has("_overbooked"))
26898      parseElementProperties(getJObject(json, "_overbooked"), res.getOverbookedElement());
26899    if (json.has("comment"))
26900      res.setCommentElement(parseString(json.get("comment").getAsString()));
26901    if (json.has("_comment"))
26902      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
26903  }
26904
26905  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
26906    Specimen res = new Specimen();
26907    parseSpecimenProperties(json, res);
26908    return res;
26909  }
26910
26911  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
26912    parseDomainResourceProperties(json, res);
26913    if (json.has("identifier")) {
26914      JsonArray array = json.getAsJsonArray("identifier");
26915      for (int i = 0; i < array.size(); i++) {
26916        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26917      }
26918    }
26919    ;
26920    if (json.has("accessionIdentifier"))
26921      res.setAccessionIdentifier(parseIdentifier(getJObject(json, "accessionIdentifier")));
26922    if (json.has("status"))
26923      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL,
26924          new Specimen.SpecimenStatusEnumFactory()));
26925    if (json.has("_status"))
26926      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26927    if (json.has("type"))
26928      res.setType(parseCodeableConcept(getJObject(json, "type")));
26929    if (json.has("subject"))
26930      res.setSubject(parseReference(getJObject(json, "subject")));
26931    if (json.has("receivedTime"))
26932      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
26933    if (json.has("_receivedTime"))
26934      parseElementProperties(getJObject(json, "_receivedTime"), res.getReceivedTimeElement());
26935    if (json.has("parent")) {
26936      JsonArray array = json.getAsJsonArray("parent");
26937      for (int i = 0; i < array.size(); i++) {
26938        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
26939      }
26940    }
26941    ;
26942    if (json.has("request")) {
26943      JsonArray array = json.getAsJsonArray("request");
26944      for (int i = 0; i < array.size(); i++) {
26945        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
26946      }
26947    }
26948    ;
26949    if (json.has("collection"))
26950      res.setCollection(parseSpecimenSpecimenCollectionComponent(getJObject(json, "collection"), res));
26951    if (json.has("processing")) {
26952      JsonArray array = json.getAsJsonArray("processing");
26953      for (int i = 0; i < array.size(); i++) {
26954        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
26955      }
26956    }
26957    ;
26958    if (json.has("container")) {
26959      JsonArray array = json.getAsJsonArray("container");
26960      for (int i = 0; i < array.size(); i++) {
26961        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
26962      }
26963    }
26964    ;
26965    if (json.has("condition")) {
26966      JsonArray array = json.getAsJsonArray("condition");
26967      for (int i = 0; i < array.size(); i++) {
26968        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26969      }
26970    }
26971    ;
26972    if (json.has("note")) {
26973      JsonArray array = json.getAsJsonArray("note");
26974      for (int i = 0; i < array.size(); i++) {
26975        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26976      }
26977    }
26978    ;
26979  }
26980
26981  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json,
26982      Specimen owner) throws IOException, FHIRFormatError {
26983    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
26984    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
26985    return res;
26986  }
26987
26988  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner,
26989      Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
26990    parseBackboneElementProperties(json, res);
26991    if (json.has("collector"))
26992      res.setCollector(parseReference(getJObject(json, "collector")));
26993    Type collected = parseType("collected", json);
26994    if (collected != null)
26995      res.setCollected(collected);
26996    if (json.has("duration"))
26997      res.setDuration(parseDuration(getJObject(json, "duration")));
26998    if (json.has("quantity"))
26999      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
27000    if (json.has("method"))
27001      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
27002    if (json.has("bodySite"))
27003      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
27004    Type fastingStatus = parseType("fastingStatus", json);
27005    if (fastingStatus != null)
27006      res.setFastingStatus(fastingStatus);
27007  }
27008
27009  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json,
27010      Specimen owner) throws IOException, FHIRFormatError {
27011    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
27012    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
27013    return res;
27014  }
27015
27016  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner,
27017      Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
27018    parseBackboneElementProperties(json, res);
27019    if (json.has("description"))
27020      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27021    if (json.has("_description"))
27022      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27023    if (json.has("procedure"))
27024      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
27025    if (json.has("additive")) {
27026      JsonArray array = json.getAsJsonArray("additive");
27027      for (int i = 0; i < array.size(); i++) {
27028        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
27029      }
27030    }
27031    ;
27032    Type time = parseType("time", json);
27033    if (time != null)
27034      res.setTime(time);
27035  }
27036
27037  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner)
27038      throws IOException, FHIRFormatError {
27039    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
27040    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
27041    return res;
27042  }
27043
27044  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner,
27045      Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
27046    parseBackboneElementProperties(json, res);
27047    if (json.has("identifier")) {
27048      JsonArray array = json.getAsJsonArray("identifier");
27049      for (int i = 0; i < array.size(); i++) {
27050        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27051      }
27052    }
27053    ;
27054    if (json.has("description"))
27055      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27056    if (json.has("_description"))
27057      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27058    if (json.has("type"))
27059      res.setType(parseCodeableConcept(getJObject(json, "type")));
27060    if (json.has("capacity"))
27061      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
27062    if (json.has("specimenQuantity"))
27063      res.setSpecimenQuantity(parseQuantity(getJObject(json, "specimenQuantity")));
27064    Type additive = parseType("additive", json);
27065    if (additive != null)
27066      res.setAdditive(additive);
27067  }
27068
27069  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
27070    SpecimenDefinition res = new SpecimenDefinition();
27071    parseSpecimenDefinitionProperties(json, res);
27072    return res;
27073  }
27074
27075  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res)
27076      throws IOException, FHIRFormatError {
27077    parseDomainResourceProperties(json, res);
27078    if (json.has("identifier"))
27079      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
27080    if (json.has("typeCollected"))
27081      res.setTypeCollected(parseCodeableConcept(getJObject(json, "typeCollected")));
27082    if (json.has("patientPreparation")) {
27083      JsonArray array = json.getAsJsonArray("patientPreparation");
27084      for (int i = 0; i < array.size(); i++) {
27085        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27086      }
27087    }
27088    ;
27089    if (json.has("timeAspect"))
27090      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
27091    if (json.has("_timeAspect"))
27092      parseElementProperties(getJObject(json, "_timeAspect"), res.getTimeAspectElement());
27093    if (json.has("collection")) {
27094      JsonArray array = json.getAsJsonArray("collection");
27095      for (int i = 0; i < array.size(); i++) {
27096        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27097      }
27098    }
27099    ;
27100    if (json.has("typeTested")) {
27101      JsonArray array = json.getAsJsonArray("typeTested");
27102      for (int i = 0; i < array.size(); i++) {
27103        res.getTypeTested()
27104            .add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject(), res));
27105      }
27106    }
27107    ;
27108  }
27109
27110  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(
27111      JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
27112    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
27113    parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(json, owner, res);
27114    return res;
27115  }
27116
27117  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(JsonObject json,
27118      SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res)
27119      throws IOException, FHIRFormatError {
27120    parseBackboneElementProperties(json, res);
27121    if (json.has("isDerived"))
27122      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
27123    if (json.has("_isDerived"))
27124      parseElementProperties(getJObject(json, "_isDerived"), res.getIsDerivedElement());
27125    if (json.has("type"))
27126      res.setType(parseCodeableConcept(getJObject(json, "type")));
27127    if (json.has("preference"))
27128      res.setPreferenceElement(
27129          parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL,
27130              new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
27131    if (json.has("_preference"))
27132      parseElementProperties(getJObject(json, "_preference"), res.getPreferenceElement());
27133    if (json.has("container"))
27134      res.setContainer(
27135          parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(getJObject(json, "container"), owner));
27136    if (json.has("requirement"))
27137      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
27138    if (json.has("_requirement"))
27139      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
27140    if (json.has("retentionTime"))
27141      res.setRetentionTime(parseDuration(getJObject(json, "retentionTime")));
27142    if (json.has("rejectionCriterion")) {
27143      JsonArray array = json.getAsJsonArray("rejectionCriterion");
27144      for (int i = 0; i < array.size(); i++) {
27145        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27146      }
27147    }
27148    ;
27149    if (json.has("handling")) {
27150      JsonArray array = json.getAsJsonArray("handling");
27151      for (int i = 0; i < array.size(); i++) {
27152        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(
27153            array.get(i).getAsJsonObject(), owner));
27154      }
27155    }
27156    ;
27157  }
27158
27159  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(
27160      JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
27161    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
27162    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(json, owner, res);
27163    return res;
27164  }
27165
27166  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json,
27167      SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res)
27168      throws IOException, FHIRFormatError {
27169    parseBackboneElementProperties(json, res);
27170    if (json.has("material"))
27171      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
27172    if (json.has("type"))
27173      res.setType(parseCodeableConcept(getJObject(json, "type")));
27174    if (json.has("cap"))
27175      res.setCap(parseCodeableConcept(getJObject(json, "cap")));
27176    if (json.has("description"))
27177      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27178    if (json.has("_description"))
27179      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27180    if (json.has("capacity"))
27181      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
27182    Type minimumVolume = parseType("minimumVolume", json);
27183    if (minimumVolume != null)
27184      res.setMinimumVolume(minimumVolume);
27185    if (json.has("additive")) {
27186      JsonArray array = json.getAsJsonArray("additive");
27187      for (int i = 0; i < array.size(); i++) {
27188        res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(
27189            array.get(i).getAsJsonObject(), owner));
27190      }
27191    }
27192    ;
27193    if (json.has("preparation"))
27194      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
27195    if (json.has("_preparation"))
27196      parseElementProperties(getJObject(json, "_preparation"), res.getPreparationElement());
27197  }
27198
27199  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(
27200      JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
27201    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
27202    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, owner, res);
27203    return res;
27204  }
27205
27206  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(
27207      JsonObject json, SpecimenDefinition owner,
27208      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res)
27209      throws IOException, FHIRFormatError {
27210    parseBackboneElementProperties(json, res);
27211    Type additive = parseType("additive", json);
27212    if (additive != null)
27213      res.setAdditive(additive);
27214  }
27215
27216  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(
27217      JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
27218    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
27219    parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(json, owner, res);
27220    return res;
27221  }
27222
27223  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json,
27224      SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res)
27225      throws IOException, FHIRFormatError {
27226    parseBackboneElementProperties(json, res);
27227    if (json.has("temperatureQualifier"))
27228      res.setTemperatureQualifier(parseCodeableConcept(getJObject(json, "temperatureQualifier")));
27229    if (json.has("temperatureRange"))
27230      res.setTemperatureRange(parseRange(getJObject(json, "temperatureRange")));
27231    if (json.has("maxDuration"))
27232      res.setMaxDuration(parseDuration(getJObject(json, "maxDuration")));
27233    if (json.has("instruction"))
27234      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
27235    if (json.has("_instruction"))
27236      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
27237  }
27238
27239  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
27240    StructureDefinition res = new StructureDefinition();
27241    parseStructureDefinitionProperties(json, res);
27242    return res;
27243  }
27244
27245  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res)
27246      throws IOException, FHIRFormatError {
27247    parseDomainResourceProperties(json, res);
27248    if (json.has("url"))
27249      res.setUrlElement(parseUri(json.get("url").getAsString()));
27250    if (json.has("_url"))
27251      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27252    if (json.has("identifier")) {
27253      JsonArray array = json.getAsJsonArray("identifier");
27254      for (int i = 0; i < array.size(); i++) {
27255        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27256      }
27257    }
27258    ;
27259    if (json.has("version"))
27260      res.setVersionElement(parseString(json.get("version").getAsString()));
27261    if (json.has("_version"))
27262      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27263    if (json.has("name"))
27264      res.setNameElement(parseString(json.get("name").getAsString()));
27265    if (json.has("_name"))
27266      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27267    if (json.has("title"))
27268      res.setTitleElement(parseString(json.get("title").getAsString()));
27269    if (json.has("_title"))
27270      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27271    if (json.has("status"))
27272      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
27273          new Enumerations.PublicationStatusEnumFactory()));
27274    if (json.has("_status"))
27275      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27276    if (json.has("experimental"))
27277      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27278    if (json.has("_experimental"))
27279      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
27280    if (json.has("date"))
27281      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27282    if (json.has("_date"))
27283      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
27284    if (json.has("publisher"))
27285      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
27286    if (json.has("_publisher"))
27287      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
27288    if (json.has("contact")) {
27289      JsonArray array = json.getAsJsonArray("contact");
27290      for (int i = 0; i < array.size(); i++) {
27291        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27292      }
27293    }
27294    ;
27295    if (json.has("description"))
27296      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27297    if (json.has("_description"))
27298      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27299    if (json.has("useContext")) {
27300      JsonArray array = json.getAsJsonArray("useContext");
27301      for (int i = 0; i < array.size(); i++) {
27302        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27303      }
27304    }
27305    ;
27306    if (json.has("jurisdiction")) {
27307      JsonArray array = json.getAsJsonArray("jurisdiction");
27308      for (int i = 0; i < array.size(); i++) {
27309        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27310      }
27311    }
27312    ;
27313    if (json.has("purpose"))
27314      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27315    if (json.has("_purpose"))
27316      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
27317    if (json.has("copyright"))
27318      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27319    if (json.has("_copyright"))
27320      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
27321    if (json.has("keyword")) {
27322      JsonArray array = json.getAsJsonArray("keyword");
27323      for (int i = 0; i < array.size(); i++) {
27324        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
27325      }
27326    }
27327    ;
27328    if (json.has("fhirVersion"))
27329      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL,
27330          new Enumerations.FHIRVersionEnumFactory()));
27331    if (json.has("_fhirVersion"))
27332      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
27333    if (json.has("mapping")) {
27334      JsonArray array = json.getAsJsonArray("mapping");
27335      for (int i = 0; i < array.size(); i++) {
27336        res.getMapping()
27337            .add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
27338      }
27339    }
27340    ;
27341    if (json.has("kind"))
27342      res.setKindElement(
27343          parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL,
27344              new StructureDefinition.StructureDefinitionKindEnumFactory()));
27345    if (json.has("_kind"))
27346      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
27347    if (json.has("abstract"))
27348      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
27349    if (json.has("_abstract"))
27350      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
27351    if (json.has("context")) {
27352      JsonArray array = json.getAsJsonArray("context");
27353      for (int i = 0; i < array.size(); i++) {
27354        res.getContext()
27355            .add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
27356      }
27357    }
27358    ;
27359    if (json.has("contextInvariant")) {
27360      JsonArray array = json.getAsJsonArray("contextInvariant");
27361      for (int i = 0; i < array.size(); i++) {
27362        if (array.get(i).isJsonNull()) {
27363          res.getContextInvariant().add(new StringType());
27364        } else {
27365          res.getContextInvariant().add(parseString(array.get(i).getAsString()));
27366        }
27367      }
27368    }
27369    ;
27370    if (json.has("_contextInvariant")) {
27371      JsonArray array = json.getAsJsonArray("_contextInvariant");
27372      for (int i = 0; i < array.size(); i++) {
27373        if (i == res.getContextInvariant().size())
27374          res.getContextInvariant().add(parseString(null));
27375        if (array.get(i) instanceof JsonObject)
27376          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
27377      }
27378    }
27379    ;
27380    if (json.has("type"))
27381      res.setTypeElement(parseUri(json.get("type").getAsString()));
27382    if (json.has("_type"))
27383      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27384    if (json.has("baseDefinition"))
27385      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
27386    if (json.has("_baseDefinition"))
27387      parseElementProperties(getJObject(json, "_baseDefinition"), res.getBaseDefinitionElement());
27388    if (json.has("derivation"))
27389      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(),
27390          StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
27391    if (json.has("_derivation"))
27392      parseElementProperties(getJObject(json, "_derivation"), res.getDerivationElement());
27393    if (json.has("snapshot"))
27394      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(getJObject(json, "snapshot"), res));
27395    if (json.has("differential"))
27396      res.setDifferential(
27397          parseStructureDefinitionStructureDefinitionDifferentialComponent(getJObject(json, "differential"), res));
27398  }
27399
27400  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(
27401      JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
27402    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
27403    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
27404    return res;
27405  }
27406
27407  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json,
27408      StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res)
27409      throws IOException, FHIRFormatError {
27410    parseBackboneElementProperties(json, res);
27411    if (json.has("identity"))
27412      res.setIdentityElement(parseId(json.get("identity").getAsString()));
27413    if (json.has("_identity"))
27414      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
27415    if (json.has("uri"))
27416      res.setUriElement(parseUri(json.get("uri").getAsString()));
27417    if (json.has("_uri"))
27418      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
27419    if (json.has("name"))
27420      res.setNameElement(parseString(json.get("name").getAsString()));
27421    if (json.has("_name"))
27422      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27423    if (json.has("comment"))
27424      res.setCommentElement(parseString(json.get("comment").getAsString()));
27425    if (json.has("_comment"))
27426      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
27427  }
27428
27429  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(
27430      JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
27431    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
27432    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
27433    return res;
27434  }
27435
27436  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json,
27437      StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res)
27438      throws IOException, FHIRFormatError {
27439    parseBackboneElementProperties(json, res);
27440    if (json.has("type"))
27441      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL,
27442          new StructureDefinition.ExtensionContextTypeEnumFactory()));
27443    if (json.has("_type"))
27444      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27445    if (json.has("expression"))
27446      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27447    if (json.has("_expression"))
27448      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
27449  }
27450
27451  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(
27452      JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
27453    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
27454    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
27455    return res;
27456  }
27457
27458  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json,
27459      StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res)
27460      throws IOException, FHIRFormatError {
27461    parseBackboneElementProperties(json, res);
27462    if (json.has("element")) {
27463      JsonArray array = json.getAsJsonArray("element");
27464      for (int i = 0; i < array.size(); i++) {
27465        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
27466      }
27467    }
27468    ;
27469  }
27470
27471  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(
27472      JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
27473    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
27474    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
27475    return res;
27476  }
27477
27478  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json,
27479      StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res)
27480      throws IOException, FHIRFormatError {
27481    parseBackboneElementProperties(json, res);
27482    if (json.has("element")) {
27483      JsonArray array = json.getAsJsonArray("element");
27484      for (int i = 0; i < array.size(); i++) {
27485        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
27486      }
27487    }
27488    ;
27489  }
27490
27491  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
27492    StructureMap res = new StructureMap();
27493    parseStructureMapProperties(json, res);
27494    return res;
27495  }
27496
27497  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
27498    parseDomainResourceProperties(json, res);
27499    if (json.has("url"))
27500      res.setUrlElement(parseUri(json.get("url").getAsString()));
27501    if (json.has("_url"))
27502      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27503    if (json.has("identifier")) {
27504      JsonArray array = json.getAsJsonArray("identifier");
27505      for (int i = 0; i < array.size(); i++) {
27506        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27507      }
27508    }
27509    ;
27510    if (json.has("version"))
27511      res.setVersionElement(parseString(json.get("version").getAsString()));
27512    if (json.has("_version"))
27513      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27514    if (json.has("name"))
27515      res.setNameElement(parseString(json.get("name").getAsString()));
27516    if (json.has("_name"))
27517      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27518    if (json.has("title"))
27519      res.setTitleElement(parseString(json.get("title").getAsString()));
27520    if (json.has("_title"))
27521      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27522    if (json.has("status"))
27523      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
27524          new Enumerations.PublicationStatusEnumFactory()));
27525    if (json.has("_status"))
27526      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27527    if (json.has("experimental"))
27528      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27529    if (json.has("_experimental"))
27530      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
27531    if (json.has("date"))
27532      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27533    if (json.has("_date"))
27534      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
27535    if (json.has("publisher"))
27536      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
27537    if (json.has("_publisher"))
27538      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
27539    if (json.has("contact")) {
27540      JsonArray array = json.getAsJsonArray("contact");
27541      for (int i = 0; i < array.size(); i++) {
27542        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27543      }
27544    }
27545    ;
27546    if (json.has("description"))
27547      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27548    if (json.has("_description"))
27549      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27550    if (json.has("useContext")) {
27551      JsonArray array = json.getAsJsonArray("useContext");
27552      for (int i = 0; i < array.size(); i++) {
27553        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27554      }
27555    }
27556    ;
27557    if (json.has("jurisdiction")) {
27558      JsonArray array = json.getAsJsonArray("jurisdiction");
27559      for (int i = 0; i < array.size(); i++) {
27560        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27561      }
27562    }
27563    ;
27564    if (json.has("purpose"))
27565      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27566    if (json.has("_purpose"))
27567      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
27568    if (json.has("copyright"))
27569      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27570    if (json.has("_copyright"))
27571      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
27572    if (json.has("structure")) {
27573      JsonArray array = json.getAsJsonArray("structure");
27574      for (int i = 0; i < array.size(); i++) {
27575        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
27576      }
27577    }
27578    ;
27579    if (json.has("import")) {
27580      JsonArray array = json.getAsJsonArray("import");
27581      for (int i = 0; i < array.size(); i++) {
27582        if (array.get(i).isJsonNull()) {
27583          res.getImport().add(new CanonicalType());
27584        } else {
27585          res.getImport().add(parseCanonical(array.get(i).getAsString()));
27586        }
27587      }
27588    }
27589    ;
27590    if (json.has("_import")) {
27591      JsonArray array = json.getAsJsonArray("_import");
27592      for (int i = 0; i < array.size(); i++) {
27593        if (i == res.getImport().size())
27594          res.getImport().add(parseCanonical(null));
27595        if (array.get(i) instanceof JsonObject)
27596          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
27597      }
27598    }
27599    ;
27600    if (json.has("group")) {
27601      JsonArray array = json.getAsJsonArray("group");
27602      for (int i = 0; i < array.size(); i++) {
27603        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
27604      }
27605    }
27606    ;
27607  }
27608
27609  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json,
27610      StructureMap owner) throws IOException, FHIRFormatError {
27611    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
27612    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
27613    return res;
27614  }
27615
27616  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner,
27617      StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
27618    parseBackboneElementProperties(json, res);
27619    if (json.has("url"))
27620      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
27621    if (json.has("_url"))
27622      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27623    if (json.has("mode"))
27624      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL,
27625          new StructureMap.StructureMapModelModeEnumFactory()));
27626    if (json.has("_mode"))
27627      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
27628    if (json.has("alias"))
27629      res.setAliasElement(parseString(json.get("alias").getAsString()));
27630    if (json.has("_alias"))
27631      parseElementProperties(getJObject(json, "_alias"), res.getAliasElement());
27632    if (json.has("documentation"))
27633      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
27634    if (json.has("_documentation"))
27635      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
27636  }
27637
27638  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json,
27639      StructureMap owner) throws IOException, FHIRFormatError {
27640    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
27641    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
27642    return res;
27643  }
27644
27645  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner,
27646      StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
27647    parseBackboneElementProperties(json, res);
27648    if (json.has("name"))
27649      res.setNameElement(parseId(json.get("name").getAsString()));
27650    if (json.has("_name"))
27651      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27652    if (json.has("extends"))
27653      res.setExtendsElement(parseId(json.get("extends").getAsString()));
27654    if (json.has("_extends"))
27655      parseElementProperties(getJObject(json, "_extends"), res.getExtendsElement());
27656    if (json.has("typeMode"))
27657      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(),
27658          StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
27659    if (json.has("_typeMode"))
27660      parseElementProperties(getJObject(json, "_typeMode"), res.getTypeModeElement());
27661    if (json.has("documentation"))
27662      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
27663    if (json.has("_documentation"))
27664      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
27665    if (json.has("input")) {
27666      JsonArray array = json.getAsJsonArray("input");
27667      for (int i = 0; i < array.size(); i++) {
27668        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
27669      }
27670    }
27671    ;
27672    if (json.has("rule")) {
27673      JsonArray array = json.getAsJsonArray("rule");
27674      for (int i = 0; i < array.size(); i++) {
27675        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
27676      }
27677    }
27678    ;
27679  }
27680
27681  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(
27682      JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
27683    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
27684    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
27685    return res;
27686  }
27687
27688  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner,
27689      StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
27690    parseBackboneElementProperties(json, res);
27691    if (json.has("name"))
27692      res.setNameElement(parseId(json.get("name").getAsString()));
27693    if (json.has("_name"))
27694      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27695    if (json.has("type"))
27696      res.setTypeElement(parseString(json.get("type").getAsString()));
27697    if (json.has("_type"))
27698      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27699    if (json.has("mode"))
27700      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL,
27701          new StructureMap.StructureMapInputModeEnumFactory()));
27702    if (json.has("_mode"))
27703      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
27704    if (json.has("documentation"))
27705      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
27706    if (json.has("_documentation"))
27707      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
27708  }
27709
27710  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json,
27711      StructureMap owner) throws IOException, FHIRFormatError {
27712    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
27713    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
27714    return res;
27715  }
27716
27717  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner,
27718      StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
27719    parseBackboneElementProperties(json, res);
27720    if (json.has("name"))
27721      res.setNameElement(parseId(json.get("name").getAsString()));
27722    if (json.has("_name"))
27723      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27724    if (json.has("source")) {
27725      JsonArray array = json.getAsJsonArray("source");
27726      for (int i = 0; i < array.size(); i++) {
27727        res.getSource()
27728            .add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
27729      }
27730    }
27731    ;
27732    if (json.has("target")) {
27733      JsonArray array = json.getAsJsonArray("target");
27734      for (int i = 0; i < array.size(); i++) {
27735        res.getTarget()
27736            .add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
27737      }
27738    }
27739    ;
27740    if (json.has("rule")) {
27741      JsonArray array = json.getAsJsonArray("rule");
27742      for (int i = 0; i < array.size(); i++) {
27743        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
27744      }
27745    }
27746    ;
27747    if (json.has("dependent")) {
27748      JsonArray array = json.getAsJsonArray("dependent");
27749      for (int i = 0; i < array.size(); i++) {
27750        res.getDependent()
27751            .add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
27752      }
27753    }
27754    ;
27755    if (json.has("documentation"))
27756      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
27757    if (json.has("_documentation"))
27758      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
27759  }
27760
27761  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(
27762      JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
27763    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
27764    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
27765    return res;
27766  }
27767
27768  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner,
27769      StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
27770    parseBackboneElementProperties(json, res);
27771    if (json.has("context"))
27772      res.setContextElement(parseId(json.get("context").getAsString()));
27773    if (json.has("_context"))
27774      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
27775    if (json.has("min"))
27776      res.setMinElement(parseInteger(json.get("min").getAsLong()));
27777    if (json.has("_min"))
27778      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
27779    if (json.has("max"))
27780      res.setMaxElement(parseString(json.get("max").getAsString()));
27781    if (json.has("_max"))
27782      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
27783    if (json.has("type"))
27784      res.setTypeElement(parseString(json.get("type").getAsString()));
27785    if (json.has("_type"))
27786      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27787    Type defaultValue = parseType("defaultValue", json);
27788    if (defaultValue != null)
27789      res.setDefaultValue(defaultValue);
27790    if (json.has("element"))
27791      res.setElementElement(parseString(json.get("element").getAsString()));
27792    if (json.has("_element"))
27793      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
27794    if (json.has("listMode"))
27795      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(),
27796          StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
27797    if (json.has("_listMode"))
27798      parseElementProperties(getJObject(json, "_listMode"), res.getListModeElement());
27799    if (json.has("variable"))
27800      res.setVariableElement(parseId(json.get("variable").getAsString()));
27801    if (json.has("_variable"))
27802      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
27803    if (json.has("condition"))
27804      res.setConditionElement(parseString(json.get("condition").getAsString()));
27805    if (json.has("_condition"))
27806      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
27807    if (json.has("check"))
27808      res.setCheckElement(parseString(json.get("check").getAsString()));
27809    if (json.has("_check"))
27810      parseElementProperties(getJObject(json, "_check"), res.getCheckElement());
27811    if (json.has("logMessage"))
27812      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
27813    if (json.has("_logMessage"))
27814      parseElementProperties(getJObject(json, "_logMessage"), res.getLogMessageElement());
27815  }
27816
27817  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(
27818      JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
27819    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
27820    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
27821    return res;
27822  }
27823
27824  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner,
27825      StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
27826    parseBackboneElementProperties(json, res);
27827    if (json.has("context"))
27828      res.setContextElement(parseId(json.get("context").getAsString()));
27829    if (json.has("_context"))
27830      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
27831    if (json.has("contextType"))
27832      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(),
27833          StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
27834    if (json.has("_contextType"))
27835      parseElementProperties(getJObject(json, "_contextType"), res.getContextTypeElement());
27836    if (json.has("element"))
27837      res.setElementElement(parseString(json.get("element").getAsString()));
27838    if (json.has("_element"))
27839      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
27840    if (json.has("variable"))
27841      res.setVariableElement(parseId(json.get("variable").getAsString()));
27842    if (json.has("_variable"))
27843      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
27844    if (json.has("listMode")) {
27845      JsonArray array = json.getAsJsonArray("listMode");
27846      for (int i = 0; i < array.size(); i++) {
27847        if (array.get(i).isJsonNull()) {
27848          res.getListMode().add(new Enumeration<StructureMap.StructureMapTargetListMode>());
27849        } else {
27850          res.getListMode().add(parseEnumeration(array.get(i).getAsString(),
27851              StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
27852        }
27853      }
27854    }
27855    ;
27856    if (json.has("_listMode")) {
27857      JsonArray array = json.getAsJsonArray("_listMode");
27858      for (int i = 0; i < array.size(); i++) {
27859        if (i == res.getListMode().size())
27860          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL,
27861              new StructureMap.StructureMapTargetListModeEnumFactory()));
27862        if (array.get(i) instanceof JsonObject)
27863          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
27864      }
27865    }
27866    ;
27867    if (json.has("listRuleId"))
27868      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
27869    if (json.has("_listRuleId"))
27870      parseElementProperties(getJObject(json, "_listRuleId"), res.getListRuleIdElement());
27871    if (json.has("transform"))
27872      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(),
27873          StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
27874    if (json.has("_transform"))
27875      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
27876    if (json.has("parameter")) {
27877      JsonArray array = json.getAsJsonArray("parameter");
27878      for (int i = 0; i < array.size(); i++) {
27879        res.getParameter()
27880            .add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
27881      }
27882    }
27883    ;
27884  }
27885
27886  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(
27887      JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
27888    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
27889    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
27890    return res;
27891  }
27892
27893  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json,
27894      StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res)
27895      throws IOException, FHIRFormatError {
27896    parseBackboneElementProperties(json, res);
27897    Type value = parseType("value", json);
27898    if (value != null)
27899      res.setValue(value);
27900  }
27901
27902  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(
27903      JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
27904    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
27905    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
27906    return res;
27907  }
27908
27909  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner,
27910      StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
27911    parseBackboneElementProperties(json, res);
27912    if (json.has("name"))
27913      res.setNameElement(parseId(json.get("name").getAsString()));
27914    if (json.has("_name"))
27915      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27916    if (json.has("variable")) {
27917      JsonArray array = json.getAsJsonArray("variable");
27918      for (int i = 0; i < array.size(); i++) {
27919        if (array.get(i).isJsonNull()) {
27920          res.getVariable().add(new StringType());
27921        } else {
27922          res.getVariable().add(parseString(array.get(i).getAsString()));
27923        }
27924      }
27925    }
27926    ;
27927    if (json.has("_variable")) {
27928      JsonArray array = json.getAsJsonArray("_variable");
27929      for (int i = 0; i < array.size(); i++) {
27930        if (i == res.getVariable().size())
27931          res.getVariable().add(parseString(null));
27932        if (array.get(i) instanceof JsonObject)
27933          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
27934      }
27935    }
27936    ;
27937  }
27938
27939  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
27940    Subscription res = new Subscription();
27941    parseSubscriptionProperties(json, res);
27942    return res;
27943  }
27944
27945  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
27946    parseDomainResourceProperties(json, res);
27947    if (json.has("status"))
27948      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL,
27949          new Subscription.SubscriptionStatusEnumFactory()));
27950    if (json.has("_status"))
27951      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27952    if (json.has("contact")) {
27953      JsonArray array = json.getAsJsonArray("contact");
27954      for (int i = 0; i < array.size(); i++) {
27955        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
27956      }
27957    }
27958    ;
27959    if (json.has("end"))
27960      res.setEndElement(parseInstant(json.get("end").getAsString()));
27961    if (json.has("_end"))
27962      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
27963    if (json.has("reason"))
27964      res.setReasonElement(parseString(json.get("reason").getAsString()));
27965    if (json.has("_reason"))
27966      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
27967    if (json.has("criteria"))
27968      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
27969    if (json.has("_criteria"))
27970      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
27971    if (json.has("error"))
27972      res.setErrorElement(parseString(json.get("error").getAsString()));
27973    if (json.has("_error"))
27974      parseElementProperties(getJObject(json, "_error"), res.getErrorElement());
27975    if (json.has("channel"))
27976      res.setChannel(parseSubscriptionSubscriptionChannelComponent(getJObject(json, "channel"), res));
27977  }
27978
27979  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json,
27980      Subscription owner) throws IOException, FHIRFormatError {
27981    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
27982    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
27983    return res;
27984  }
27985
27986  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner,
27987      Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
27988    parseBackboneElementProperties(json, res);
27989    if (json.has("type"))
27990      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL,
27991          new Subscription.SubscriptionChannelTypeEnumFactory()));
27992    if (json.has("_type"))
27993      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
27994    if (json.has("endpoint"))
27995      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
27996    if (json.has("_endpoint"))
27997      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
27998    if (json.has("payload"))
27999      res.setPayloadElement(parseCode(json.get("payload").getAsString()));
28000    if (json.has("_payload"))
28001      parseElementProperties(getJObject(json, "_payload"), res.getPayloadElement());
28002    if (json.has("header")) {
28003      JsonArray array = json.getAsJsonArray("header");
28004      for (int i = 0; i < array.size(); i++) {
28005        if (array.get(i).isJsonNull()) {
28006          res.getHeader().add(new StringType());
28007        } else {
28008          res.getHeader().add(parseString(array.get(i).getAsString()));
28009        }
28010      }
28011    }
28012    ;
28013    if (json.has("_header")) {
28014      JsonArray array = json.getAsJsonArray("_header");
28015      for (int i = 0; i < array.size(); i++) {
28016        if (i == res.getHeader().size())
28017          res.getHeader().add(parseString(null));
28018        if (array.get(i) instanceof JsonObject)
28019          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
28020      }
28021    }
28022    ;
28023  }
28024
28025  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
28026    Substance res = new Substance();
28027    parseSubstanceProperties(json, res);
28028    return res;
28029  }
28030
28031  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
28032    parseDomainResourceProperties(json, res);
28033    if (json.has("identifier")) {
28034      JsonArray array = json.getAsJsonArray("identifier");
28035      for (int i = 0; i < array.size(); i++) {
28036        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28037      }
28038    }
28039    ;
28040    if (json.has("status"))
28041      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL,
28042          new Substance.FHIRSubstanceStatusEnumFactory()));
28043    if (json.has("_status"))
28044      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
28045    if (json.has("category")) {
28046      JsonArray array = json.getAsJsonArray("category");
28047      for (int i = 0; i < array.size(); i++) {
28048        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28049      }
28050    }
28051    ;
28052    if (json.has("code"))
28053      res.setCode(parseCodeableConcept(getJObject(json, "code")));
28054    if (json.has("description"))
28055      res.setDescriptionElement(parseString(json.get("description").getAsString()));
28056    if (json.has("_description"))
28057      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28058    if (json.has("instance")) {
28059      JsonArray array = json.getAsJsonArray("instance");
28060      for (int i = 0; i < array.size(); i++) {
28061        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
28062      }
28063    }
28064    ;
28065    if (json.has("ingredient")) {
28066      JsonArray array = json.getAsJsonArray("ingredient");
28067      for (int i = 0; i < array.size(); i++) {
28068        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
28069      }
28070    }
28071    ;
28072  }
28073
28074  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json,
28075      Substance owner) throws IOException, FHIRFormatError {
28076    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
28077    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
28078    return res;
28079  }
28080
28081  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner,
28082      Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
28083    parseBackboneElementProperties(json, res);
28084    if (json.has("identifier"))
28085      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
28086    if (json.has("expiry"))
28087      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
28088    if (json.has("_expiry"))
28089      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
28090    if (json.has("quantity"))
28091      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
28092  }
28093
28094  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json,
28095      Substance owner) throws IOException, FHIRFormatError {
28096    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
28097    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
28098    return res;
28099  }
28100
28101  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner,
28102      Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
28103    parseBackboneElementProperties(json, res);
28104    if (json.has("quantity"))
28105      res.setQuantity(parseRatio(getJObject(json, "quantity")));
28106    Type substance = parseType("substance", json);
28107    if (substance != null)
28108      res.setSubstance(substance);
28109  }
28110
28111  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
28112    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
28113    parseSubstanceNucleicAcidProperties(json, res);
28114    return res;
28115  }
28116
28117  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res)
28118      throws IOException, FHIRFormatError {
28119    parseDomainResourceProperties(json, res);
28120    if (json.has("sequenceType"))
28121      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
28122    if (json.has("numberOfSubunits"))
28123      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
28124    if (json.has("_numberOfSubunits"))
28125      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
28126    if (json.has("areaOfHybridisation"))
28127      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
28128    if (json.has("_areaOfHybridisation"))
28129      parseElementProperties(getJObject(json, "_areaOfHybridisation"), res.getAreaOfHybridisationElement());
28130    if (json.has("oligoNucleotideType"))
28131      res.setOligoNucleotideType(parseCodeableConcept(getJObject(json, "oligoNucleotideType")));
28132    if (json.has("subunit")) {
28133      JsonArray array = json.getAsJsonArray("subunit");
28134      for (int i = 0; i < array.size(); i++) {
28135        res.getSubunit()
28136            .add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject(), res));
28137      }
28138    }
28139    ;
28140  }
28141
28142  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(
28143      JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
28144    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
28145    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(json, owner, res);
28146    return res;
28147  }
28148
28149  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(JsonObject json,
28150      SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res)
28151      throws IOException, FHIRFormatError {
28152    parseBackboneElementProperties(json, res);
28153    if (json.has("subunit"))
28154      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
28155    if (json.has("_subunit"))
28156      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
28157    if (json.has("sequence"))
28158      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
28159    if (json.has("_sequence"))
28160      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
28161    if (json.has("length"))
28162      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
28163    if (json.has("_length"))
28164      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
28165    if (json.has("sequenceAttachment"))
28166      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
28167    if (json.has("fivePrime"))
28168      res.setFivePrime(parseCodeableConcept(getJObject(json, "fivePrime")));
28169    if (json.has("threePrime"))
28170      res.setThreePrime(parseCodeableConcept(getJObject(json, "threePrime")));
28171    if (json.has("linkage")) {
28172      JsonArray array = json.getAsJsonArray("linkage");
28173      for (int i = 0; i < array.size(); i++) {
28174        res.getLinkage().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(
28175            array.get(i).getAsJsonObject(), owner));
28176      }
28177    }
28178    ;
28179    if (json.has("sugar")) {
28180      JsonArray array = json.getAsJsonArray("sugar");
28181      for (int i = 0; i < array.size(); i++) {
28182        res.getSugar().add(
28183            parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject(), owner));
28184      }
28185    }
28186    ;
28187  }
28188
28189  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(
28190      JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
28191    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
28192    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(json, owner, res);
28193    return res;
28194  }
28195
28196  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json,
28197      SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res)
28198      throws IOException, FHIRFormatError {
28199    parseBackboneElementProperties(json, res);
28200    if (json.has("connectivity"))
28201      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
28202    if (json.has("_connectivity"))
28203      parseElementProperties(getJObject(json, "_connectivity"), res.getConnectivityElement());
28204    if (json.has("identifier"))
28205      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
28206    if (json.has("name"))
28207      res.setNameElement(parseString(json.get("name").getAsString()));
28208    if (json.has("_name"))
28209      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28210    if (json.has("residueSite"))
28211      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
28212    if (json.has("_residueSite"))
28213      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
28214  }
28215
28216  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(
28217      JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
28218    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
28219    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(json, owner, res);
28220    return res;
28221  }
28222
28223  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json,
28224      SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res)
28225      throws IOException, FHIRFormatError {
28226    parseBackboneElementProperties(json, res);
28227    if (json.has("identifier"))
28228      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
28229    if (json.has("name"))
28230      res.setNameElement(parseString(json.get("name").getAsString()));
28231    if (json.has("_name"))
28232      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
28233    if (json.has("residueSite"))
28234      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
28235    if (json.has("_residueSite"))
28236      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
28237  }
28238
28239  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
28240    SubstancePolymer res = new SubstancePolymer();
28241    parseSubstancePolymerProperties(json, res);
28242    return res;
28243  }
28244
28245  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res)
28246      throws IOException, FHIRFormatError {
28247    parseDomainResourceProperties(json, res);
28248    if (json.has("class"))
28249      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
28250    if (json.has("geometry"))
28251      res.setGeometry(parseCodeableConcept(getJObject(json, "geometry")));
28252    if (json.has("copolymerConnectivity")) {
28253      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
28254      for (int i = 0; i < array.size(); i++) {
28255        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28256      }
28257    }
28258    ;
28259    if (json.has("modification")) {
28260      JsonArray array = json.getAsJsonArray("modification");
28261      for (int i = 0; i < array.size(); i++) {
28262        if (array.get(i).isJsonNull()) {
28263          res.getModification().add(new StringType());
28264        } else {
28265          res.getModification().add(parseString(array.get(i).getAsString()));
28266        }
28267      }
28268    }
28269    ;
28270    if (json.has("_modification")) {
28271      JsonArray array = json.getAsJsonArray("_modification");
28272      for (int i = 0; i < array.size(); i++) {
28273        if (i == res.getModification().size())
28274          res.getModification().add(parseString(null));
28275        if (array.get(i) instanceof JsonObject)
28276          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
28277      }
28278    }
28279    ;
28280    if (json.has("monomerSet")) {
28281      JsonArray array = json.getAsJsonArray("monomerSet");
28282      for (int i = 0; i < array.size(); i++) {
28283        res.getMonomerSet()
28284            .add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
28285      }
28286    }
28287    ;
28288    if (json.has("repeat")) {
28289      JsonArray array = json.getAsJsonArray("repeat");
28290      for (int i = 0; i < array.size(); i++) {
28291        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
28292      }
28293    }
28294    ;
28295  }
28296
28297  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(
28298      JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
28299    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
28300    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
28301    return res;
28302  }
28303
28304  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json,
28305      SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res)
28306      throws IOException, FHIRFormatError {
28307    parseBackboneElementProperties(json, res);
28308    if (json.has("ratioType"))
28309      res.setRatioType(parseCodeableConcept(getJObject(json, "ratioType")));
28310    if (json.has("startingMaterial")) {
28311      JsonArray array = json.getAsJsonArray("startingMaterial");
28312      for (int i = 0; i < array.size(); i++) {
28313        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(
28314            array.get(i).getAsJsonObject(), owner));
28315      }
28316    }
28317    ;
28318  }
28319
28320  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(
28321      JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
28322    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
28323    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
28324    return res;
28325  }
28326
28327  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json,
28328      SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res)
28329      throws IOException, FHIRFormatError {
28330    parseBackboneElementProperties(json, res);
28331    if (json.has("material"))
28332      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
28333    if (json.has("type"))
28334      res.setType(parseCodeableConcept(getJObject(json, "type")));
28335    if (json.has("isDefining"))
28336      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
28337    if (json.has("_isDefining"))
28338      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
28339    if (json.has("amount"))
28340      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
28341  }
28342
28343  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(
28344      JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
28345    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
28346    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
28347    return res;
28348  }
28349
28350  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner,
28351      SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
28352    parseBackboneElementProperties(json, res);
28353    if (json.has("numberOfUnits"))
28354      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
28355    if (json.has("_numberOfUnits"))
28356      parseElementProperties(getJObject(json, "_numberOfUnits"), res.getNumberOfUnitsElement());
28357    if (json.has("averageMolecularFormula"))
28358      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
28359    if (json.has("_averageMolecularFormula"))
28360      parseElementProperties(getJObject(json, "_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
28361    if (json.has("repeatUnitAmountType"))
28362      res.setRepeatUnitAmountType(parseCodeableConcept(getJObject(json, "repeatUnitAmountType")));
28363    if (json.has("repeatUnit")) {
28364      JsonArray array = json.getAsJsonArray("repeatUnit");
28365      for (int i = 0; i < array.size(); i++) {
28366        res.getRepeatUnit()
28367            .add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
28368      }
28369    }
28370    ;
28371  }
28372
28373  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(
28374      JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
28375    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
28376    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
28377    return res;
28378  }
28379
28380  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json,
28381      SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res)
28382      throws IOException, FHIRFormatError {
28383    parseBackboneElementProperties(json, res);
28384    if (json.has("orientationOfPolymerisation"))
28385      res.setOrientationOfPolymerisation(parseCodeableConcept(getJObject(json, "orientationOfPolymerisation")));
28386    if (json.has("repeatUnit"))
28387      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
28388    if (json.has("_repeatUnit"))
28389      parseElementProperties(getJObject(json, "_repeatUnit"), res.getRepeatUnitElement());
28390    if (json.has("amount"))
28391      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
28392    if (json.has("degreeOfPolymerisation")) {
28393      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
28394      for (int i = 0; i < array.size(); i++) {
28395        res.getDegreeOfPolymerisation()
28396            .add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(
28397                array.get(i).getAsJsonObject(), owner));
28398      }
28399    }
28400    ;
28401    if (json.has("structuralRepresentation")) {
28402      JsonArray array = json.getAsJsonArray("structuralRepresentation");
28403      for (int i = 0; i < array.size(); i++) {
28404        res.getStructuralRepresentation()
28405            .add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(
28406                array.get(i).getAsJsonObject(), owner));
28407      }
28408    }
28409    ;
28410  }
28411
28412  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(
28413      JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
28414    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
28415    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
28416    return res;
28417  }
28418
28419  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(
28420      JsonObject json, SubstancePolymer owner,
28421      SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res)
28422      throws IOException, FHIRFormatError {
28423    parseBackboneElementProperties(json, res);
28424    if (json.has("degree"))
28425      res.setDegree(parseCodeableConcept(getJObject(json, "degree")));
28426    if (json.has("amount"))
28427      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
28428  }
28429
28430  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(
28431      JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
28432    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
28433    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
28434    return res;
28435  }
28436
28437  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(
28438      JsonObject json, SubstancePolymer owner,
28439      SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res)
28440      throws IOException, FHIRFormatError {
28441    parseBackboneElementProperties(json, res);
28442    if (json.has("type"))
28443      res.setType(parseCodeableConcept(getJObject(json, "type")));
28444    if (json.has("representation"))
28445      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
28446    if (json.has("_representation"))
28447      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
28448    if (json.has("attachment"))
28449      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
28450  }
28451
28452  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
28453    SubstanceProtein res = new SubstanceProtein();
28454    parseSubstanceProteinProperties(json, res);
28455    return res;
28456  }
28457
28458  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res)
28459      throws IOException, FHIRFormatError {
28460    parseDomainResourceProperties(json, res);
28461    if (json.has("sequenceType"))
28462      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
28463    if (json.has("numberOfSubunits"))
28464      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
28465    if (json.has("_numberOfSubunits"))
28466      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
28467    if (json.has("disulfideLinkage")) {
28468      JsonArray array = json.getAsJsonArray("disulfideLinkage");
28469      for (int i = 0; i < array.size(); i++) {
28470        if (array.get(i).isJsonNull()) {
28471          res.getDisulfideLinkage().add(new StringType());
28472        } else {
28473          res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
28474        }
28475      }
28476    }
28477    ;
28478    if (json.has("_disulfideLinkage")) {
28479      JsonArray array = json.getAsJsonArray("_disulfideLinkage");
28480      for (int i = 0; i < array.size(); i++) {
28481        if (i == res.getDisulfideLinkage().size())
28482          res.getDisulfideLinkage().add(parseString(null));
28483        if (array.get(i) instanceof JsonObject)
28484          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
28485      }
28486    }
28487    ;
28488    if (json.has("subunit")) {
28489      JsonArray array = json.getAsJsonArray("subunit");
28490      for (int i = 0; i < array.size(); i++) {
28491        res.getSubunit()
28492            .add(parseSubstanceProteinSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject(), res));
28493      }
28494    }
28495    ;
28496  }
28497
28498  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubstanceProteinSubunitComponent(
28499      JsonObject json, SubstanceProtein owner) throws IOException, FHIRFormatError {
28500    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
28501    parseSubstanceProteinSubstanceProteinSubunitComponentProperties(json, owner, res);
28502    return res;
28503  }
28504
28505  protected void parseSubstanceProteinSubstanceProteinSubunitComponentProperties(JsonObject json,
28506      SubstanceProtein owner, SubstanceProtein.SubstanceProteinSubunitComponent res)
28507      throws IOException, FHIRFormatError {
28508    parseBackboneElementProperties(json, res);
28509    if (json.has("subunit"))
28510      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
28511    if (json.has("_subunit"))
28512      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
28513    if (json.has("sequence"))
28514      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
28515    if (json.has("_sequence"))
28516      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
28517    if (json.has("length"))
28518      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
28519    if (json.has("_length"))
28520      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
28521    if (json.has("sequenceAttachment"))
28522      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
28523    if (json.has("nTerminalModificationId"))
28524      res.setNTerminalModificationId(parseIdentifier(getJObject(json, "nTerminalModificationId")));
28525    if (json.has("nTerminalModification"))
28526      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
28527    if (json.has("_nTerminalModification"))
28528      parseElementProperties(getJObject(json, "_nTerminalModification"), res.getNTerminalModificationElement());
28529    if (json.has("cTerminalModificationId"))
28530      res.setCTerminalModificationId(parseIdentifier(getJObject(json, "cTerminalModificationId")));
28531    if (json.has("cTerminalModification"))
28532      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
28533    if (json.has("_cTerminalModification"))
28534      parseElementProperties(getJObject(json, "_cTerminalModification"), res.getCTerminalModificationElement());
28535  }
28536
28537  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json)
28538      throws IOException, FHIRFormatError {
28539    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
28540    parseSubstanceReferenceInformationProperties(json, res);
28541    return res;
28542  }
28543
28544  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res)
28545      throws IOException, FHIRFormatError {
28546    parseDomainResourceProperties(json, res);
28547    if (json.has("comment"))
28548      res.setCommentElement(parseString(json.get("comment").getAsString()));
28549    if (json.has("_comment"))
28550      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
28551    if (json.has("gene")) {
28552      JsonArray array = json.getAsJsonArray("gene");
28553      for (int i = 0; i < array.size(); i++) {
28554        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(
28555            array.get(i).getAsJsonObject(), res));
28556      }
28557    }
28558    ;
28559    if (json.has("geneElement")) {
28560      JsonArray array = json.getAsJsonArray("geneElement");
28561      for (int i = 0; i < array.size(); i++) {
28562        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(
28563            array.get(i).getAsJsonObject(), res));
28564      }
28565    }
28566    ;
28567    if (json.has("classification")) {
28568      JsonArray array = json.getAsJsonArray("classification");
28569      for (int i = 0; i < array.size(); i++) {
28570        res.getClassification()
28571            .add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(
28572                array.get(i).getAsJsonObject(), res));
28573      }
28574    }
28575    ;
28576    if (json.has("target")) {
28577      JsonArray array = json.getAsJsonArray("target");
28578      for (int i = 0; i < array.size(); i++) {
28579        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(
28580            array.get(i).getAsJsonObject(), res));
28581      }
28582    }
28583    ;
28584  }
28585
28586  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(
28587      JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
28588    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
28589    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
28590    return res;
28591  }
28592
28593  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json,
28594      SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res)
28595      throws IOException, FHIRFormatError {
28596    parseBackboneElementProperties(json, res);
28597    if (json.has("geneSequenceOrigin"))
28598      res.setGeneSequenceOrigin(parseCodeableConcept(getJObject(json, "geneSequenceOrigin")));
28599    if (json.has("gene"))
28600      res.setGene(parseCodeableConcept(getJObject(json, "gene")));
28601    if (json.has("source")) {
28602      JsonArray array = json.getAsJsonArray("source");
28603      for (int i = 0; i < array.size(); i++) {
28604        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
28605      }
28606    }
28607    ;
28608  }
28609
28610  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(
28611      JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
28612    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
28613    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
28614    return res;
28615  }
28616
28617  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(
28618      JsonObject json, SubstanceReferenceInformation owner,
28619      SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res)
28620      throws IOException, FHIRFormatError {
28621    parseBackboneElementProperties(json, res);
28622    if (json.has("type"))
28623      res.setType(parseCodeableConcept(getJObject(json, "type")));
28624    if (json.has("element"))
28625      res.setElement(parseIdentifier(getJObject(json, "element")));
28626    if (json.has("source")) {
28627      JsonArray array = json.getAsJsonArray("source");
28628      for (int i = 0; i < array.size(); i++) {
28629        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
28630      }
28631    }
28632    ;
28633  }
28634
28635  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(
28636      JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
28637    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
28638    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
28639    return res;
28640  }
28641
28642  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(
28643      JsonObject json, SubstanceReferenceInformation owner,
28644      SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res)
28645      throws IOException, FHIRFormatError {
28646    parseBackboneElementProperties(json, res);
28647    if (json.has("domain"))
28648      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
28649    if (json.has("classification"))
28650      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
28651    if (json.has("subtype")) {
28652      JsonArray array = json.getAsJsonArray("subtype");
28653      for (int i = 0; i < array.size(); i++) {
28654        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28655      }
28656    }
28657    ;
28658    if (json.has("source")) {
28659      JsonArray array = json.getAsJsonArray("source");
28660      for (int i = 0; i < array.size(); i++) {
28661        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
28662      }
28663    }
28664    ;
28665  }
28666
28667  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(
28668      JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
28669    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
28670    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
28671    return res;
28672  }
28673
28674  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(
28675      JsonObject json, SubstanceReferenceInformation owner,
28676      SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res)
28677      throws IOException, FHIRFormatError {
28678    parseBackboneElementProperties(json, res);
28679    if (json.has("target"))
28680      res.setTarget(parseIdentifier(getJObject(json, "target")));
28681    if (json.has("type"))
28682      res.setType(parseCodeableConcept(getJObject(json, "type")));
28683    if (json.has("interaction"))
28684      res.setInteraction(parseCodeableConcept(getJObject(json, "interaction")));
28685    if (json.has("organism"))
28686      res.setOrganism(parseCodeableConcept(getJObject(json, "organism")));
28687    if (json.has("organismType"))
28688      res.setOrganismType(parseCodeableConcept(getJObject(json, "organismType")));
28689    Type amount = parseType("amount", json);
28690    if (amount != null)
28691      res.setAmount(amount);
28692    if (json.has("amountType"))
28693      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
28694    if (json.has("source")) {
28695      JsonArray array = json.getAsJsonArray("source");
28696      for (int i = 0; i < array.size(); i++) {
28697        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
28698      }
28699    }
28700    ;
28701  }
28702
28703  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
28704    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
28705    parseSubstanceSourceMaterialProperties(json, res);
28706    return res;
28707  }
28708
28709  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res)
28710      throws IOException, FHIRFormatError {
28711    parseDomainResourceProperties(json, res);
28712    if (json.has("sourceMaterialClass"))
28713      res.setSourceMaterialClass(parseCodeableConcept(getJObject(json, "sourceMaterialClass")));
28714    if (json.has("sourceMaterialType"))
28715      res.setSourceMaterialType(parseCodeableConcept(getJObject(json, "sourceMaterialType")));
28716    if (json.has("sourceMaterialState"))
28717      res.setSourceMaterialState(parseCodeableConcept(getJObject(json, "sourceMaterialState")));
28718    if (json.has("organismId"))
28719      res.setOrganismId(parseIdentifier(getJObject(json, "organismId")));
28720    if (json.has("organismName"))
28721      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
28722    if (json.has("_organismName"))
28723      parseElementProperties(getJObject(json, "_organismName"), res.getOrganismNameElement());
28724    if (json.has("parentSubstanceId")) {
28725      JsonArray array = json.getAsJsonArray("parentSubstanceId");
28726      for (int i = 0; i < array.size(); i++) {
28727        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
28728      }
28729    }
28730    ;
28731    if (json.has("parentSubstanceName")) {
28732      JsonArray array = json.getAsJsonArray("parentSubstanceName");
28733      for (int i = 0; i < array.size(); i++) {
28734        if (array.get(i).isJsonNull()) {
28735          res.getParentSubstanceName().add(new StringType());
28736        } else {
28737          res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
28738        }
28739      }
28740    }
28741    ;
28742    if (json.has("_parentSubstanceName")) {
28743      JsonArray array = json.getAsJsonArray("_parentSubstanceName");
28744      for (int i = 0; i < array.size(); i++) {
28745        if (i == res.getParentSubstanceName().size())
28746          res.getParentSubstanceName().add(parseString(null));
28747        if (array.get(i) instanceof JsonObject)
28748          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
28749      }
28750    }
28751    ;
28752    if (json.has("countryOfOrigin")) {
28753      JsonArray array = json.getAsJsonArray("countryOfOrigin");
28754      for (int i = 0; i < array.size(); i++) {
28755        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28756      }
28757    }
28758    ;
28759    if (json.has("geographicalLocation")) {
28760      JsonArray array = json.getAsJsonArray("geographicalLocation");
28761      for (int i = 0; i < array.size(); i++) {
28762        if (array.get(i).isJsonNull()) {
28763          res.getGeographicalLocation().add(new StringType());
28764        } else {
28765          res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
28766        }
28767      }
28768    }
28769    ;
28770    if (json.has("_geographicalLocation")) {
28771      JsonArray array = json.getAsJsonArray("_geographicalLocation");
28772      for (int i = 0; i < array.size(); i++) {
28773        if (i == res.getGeographicalLocation().size())
28774          res.getGeographicalLocation().add(parseString(null));
28775        if (array.get(i) instanceof JsonObject)
28776          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
28777      }
28778    }
28779    ;
28780    if (json.has("developmentStage"))
28781      res.setDevelopmentStage(parseCodeableConcept(getJObject(json, "developmentStage")));
28782    if (json.has("fractionDescription")) {
28783      JsonArray array = json.getAsJsonArray("fractionDescription");
28784      for (int i = 0; i < array.size(); i++) {
28785        res.getFractionDescription()
28786            .add(parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(
28787                array.get(i).getAsJsonObject(), res));
28788      }
28789    }
28790    ;
28791    if (json.has("organism"))
28792      res.setOrganism(
28793          parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(getJObject(json, "organism"), res));
28794    if (json.has("partDescription")) {
28795      JsonArray array = json.getAsJsonArray("partDescription");
28796      for (int i = 0; i < array.size(); i++) {
28797        res.getPartDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(
28798            array.get(i).getAsJsonObject(), res));
28799      }
28800    }
28801    ;
28802  }
28803
28804  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(
28805      JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
28806    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
28807    parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(json, owner, res);
28808    return res;
28809  }
28810
28811  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(
28812      JsonObject json, SubstanceSourceMaterial owner,
28813      SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res)
28814      throws IOException, FHIRFormatError {
28815    parseBackboneElementProperties(json, res);
28816    if (json.has("fraction"))
28817      res.setFractionElement(parseString(json.get("fraction").getAsString()));
28818    if (json.has("_fraction"))
28819      parseElementProperties(getJObject(json, "_fraction"), res.getFractionElement());
28820    if (json.has("materialType"))
28821      res.setMaterialType(parseCodeableConcept(getJObject(json, "materialType")));
28822  }
28823
28824  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(
28825      JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
28826    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
28827    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(json, owner, res);
28828    return res;
28829  }
28830
28831  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(JsonObject json,
28832      SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res)
28833      throws IOException, FHIRFormatError {
28834    parseBackboneElementProperties(json, res);
28835    if (json.has("family"))
28836      res.setFamily(parseCodeableConcept(getJObject(json, "family")));
28837    if (json.has("genus"))
28838      res.setGenus(parseCodeableConcept(getJObject(json, "genus")));
28839    if (json.has("species"))
28840      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
28841    if (json.has("intraspecificType"))
28842      res.setIntraspecificType(parseCodeableConcept(getJObject(json, "intraspecificType")));
28843    if (json.has("intraspecificDescription"))
28844      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
28845    if (json.has("_intraspecificDescription"))
28846      parseElementProperties(getJObject(json, "_intraspecificDescription"), res.getIntraspecificDescriptionElement());
28847    if (json.has("author")) {
28848      JsonArray array = json.getAsJsonArray("author");
28849      for (int i = 0; i < array.size(); i++) {
28850        res.getAuthor().add(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(
28851            array.get(i).getAsJsonObject(), owner));
28852      }
28853    }
28854    ;
28855    if (json.has("hybrid"))
28856      res.setHybrid(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(
28857          getJObject(json, "hybrid"), owner));
28858    if (json.has("organismGeneral"))
28859      res.setOrganismGeneral(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(
28860          getJObject(json, "organismGeneral"), owner));
28861  }
28862
28863  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(
28864      JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
28865    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
28866    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(json, owner, res);
28867    return res;
28868  }
28869
28870  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json,
28871      SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res)
28872      throws IOException, FHIRFormatError {
28873    parseBackboneElementProperties(json, res);
28874    if (json.has("authorType"))
28875      res.setAuthorType(parseCodeableConcept(getJObject(json, "authorType")));
28876    if (json.has("authorDescription"))
28877      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
28878    if (json.has("_authorDescription"))
28879      parseElementProperties(getJObject(json, "_authorDescription"), res.getAuthorDescriptionElement());
28880  }
28881
28882  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(
28883      JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
28884    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
28885    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(json, owner, res);
28886    return res;
28887  }
28888
28889  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json,
28890      SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res)
28891      throws IOException, FHIRFormatError {
28892    parseBackboneElementProperties(json, res);
28893    if (json.has("maternalOrganismId"))
28894      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
28895    if (json.has("_maternalOrganismId"))
28896      parseElementProperties(getJObject(json, "_maternalOrganismId"), res.getMaternalOrganismIdElement());
28897    if (json.has("maternalOrganismName"))
28898      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
28899    if (json.has("_maternalOrganismName"))
28900      parseElementProperties(getJObject(json, "_maternalOrganismName"), res.getMaternalOrganismNameElement());
28901    if (json.has("paternalOrganismId"))
28902      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
28903    if (json.has("_paternalOrganismId"))
28904      parseElementProperties(getJObject(json, "_paternalOrganismId"), res.getPaternalOrganismIdElement());
28905    if (json.has("paternalOrganismName"))
28906      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
28907    if (json.has("_paternalOrganismName"))
28908      parseElementProperties(getJObject(json, "_paternalOrganismName"), res.getPaternalOrganismNameElement());
28909    if (json.has("hybridType"))
28910      res.setHybridType(parseCodeableConcept(getJObject(json, "hybridType")));
28911  }
28912
28913  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(
28914      JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
28915    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
28916    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, owner, res);
28917    return res;
28918  }
28919
28920  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(
28921      JsonObject json, SubstanceSourceMaterial owner,
28922      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res)
28923      throws IOException, FHIRFormatError {
28924    parseBackboneElementProperties(json, res);
28925    if (json.has("kingdom"))
28926      res.setKingdom(parseCodeableConcept(getJObject(json, "kingdom")));
28927    if (json.has("phylum"))
28928      res.setPhylum(parseCodeableConcept(getJObject(json, "phylum")));
28929    if (json.has("class"))
28930      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
28931    if (json.has("order"))
28932      res.setOrder(parseCodeableConcept(getJObject(json, "order")));
28933  }
28934
28935  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(
28936      JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
28937    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
28938    parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(json, owner, res);
28939    return res;
28940  }
28941
28942  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json,
28943      SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res)
28944      throws IOException, FHIRFormatError {
28945    parseBackboneElementProperties(json, res);
28946    if (json.has("part"))
28947      res.setPart(parseCodeableConcept(getJObject(json, "part")));
28948    if (json.has("partLocation"))
28949      res.setPartLocation(parseCodeableConcept(getJObject(json, "partLocation")));
28950  }
28951
28952  protected SubstanceSpecification parseSubstanceSpecification(JsonObject json) throws IOException, FHIRFormatError {
28953    SubstanceSpecification res = new SubstanceSpecification();
28954    parseSubstanceSpecificationProperties(json, res);
28955    return res;
28956  }
28957
28958  protected void parseSubstanceSpecificationProperties(JsonObject json, SubstanceSpecification res)
28959      throws IOException, FHIRFormatError {
28960    parseDomainResourceProperties(json, res);
28961    if (json.has("identifier"))
28962      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
28963    if (json.has("type"))
28964      res.setType(parseCodeableConcept(getJObject(json, "type")));
28965    if (json.has("status"))
28966      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
28967    if (json.has("domain"))
28968      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
28969    if (json.has("description"))
28970      res.setDescriptionElement(parseString(json.get("description").getAsString()));
28971    if (json.has("_description"))
28972      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
28973    if (json.has("source")) {
28974      JsonArray array = json.getAsJsonArray("source");
28975      for (int i = 0; i < array.size(); i++) {
28976        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
28977      }
28978    }
28979    ;
28980    if (json.has("comment"))
28981      res.setCommentElement(parseString(json.get("comment").getAsString()));
28982    if (json.has("_comment"))
28983      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
28984    if (json.has("moiety")) {
28985      JsonArray array = json.getAsJsonArray("moiety");
28986      for (int i = 0; i < array.size(); i++) {
28987        res.getMoiety()
28988            .add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(array.get(i).getAsJsonObject(), res));
28989      }
28990    }
28991    ;
28992    if (json.has("property")) {
28993      JsonArray array = json.getAsJsonArray("property");
28994      for (int i = 0; i < array.size(); i++) {
28995        res.getProperty().add(
28996            parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(array.get(i).getAsJsonObject(), res));
28997      }
28998    }
28999    ;
29000    if (json.has("referenceInformation"))
29001      res.setReferenceInformation(parseReference(getJObject(json, "referenceInformation")));
29002    if (json.has("structure"))
29003      res.setStructure(
29004          parseSubstanceSpecificationSubstanceSpecificationStructureComponent(getJObject(json, "structure"), res));
29005    if (json.has("code")) {
29006      JsonArray array = json.getAsJsonArray("code");
29007      for (int i = 0; i < array.size(); i++) {
29008        res.getCode()
29009            .add(parseSubstanceSpecificationSubstanceSpecificationCodeComponent(array.get(i).getAsJsonObject(), res));
29010      }
29011    }
29012    ;
29013    if (json.has("name")) {
29014      JsonArray array = json.getAsJsonArray("name");
29015      for (int i = 0; i < array.size(); i++) {
29016        res.getName()
29017            .add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), res));
29018      }
29019    }
29020    ;
29021    if (json.has("molecularWeight")) {
29022      JsonArray array = json.getAsJsonArray("molecularWeight");
29023      for (int i = 0; i < array.size(); i++) {
29024        res.getMolecularWeight()
29025            .add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(
29026                array.get(i).getAsJsonObject(), res));
29027      }
29028    }
29029    ;
29030    if (json.has("relationship")) {
29031      JsonArray array = json.getAsJsonArray("relationship");
29032      for (int i = 0; i < array.size(); i++) {
29033        res.getRelationship().add(parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(
29034            array.get(i).getAsJsonObject(), res));
29035      }
29036    }
29037    ;
29038    if (json.has("nucleicAcid"))
29039      res.setNucleicAcid(parseReference(getJObject(json, "nucleicAcid")));
29040    if (json.has("polymer"))
29041      res.setPolymer(parseReference(getJObject(json, "polymer")));
29042    if (json.has("protein"))
29043      res.setProtein(parseReference(getJObject(json, "protein")));
29044    if (json.has("sourceMaterial"))
29045      res.setSourceMaterial(parseReference(getJObject(json, "sourceMaterial")));
29046  }
29047
29048  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(
29049      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29050    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
29051    parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(json, owner, res);
29052    return res;
29053  }
29054
29055  protected void parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(JsonObject json,
29056      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent res)
29057      throws IOException, FHIRFormatError {
29058    parseBackboneElementProperties(json, res);
29059    if (json.has("role"))
29060      res.setRole(parseCodeableConcept(getJObject(json, "role")));
29061    if (json.has("identifier"))
29062      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
29063    if (json.has("name"))
29064      res.setNameElement(parseString(json.get("name").getAsString()));
29065    if (json.has("_name"))
29066      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
29067    if (json.has("stereochemistry"))
29068      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
29069    if (json.has("opticalActivity"))
29070      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
29071    if (json.has("molecularFormula"))
29072      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
29073    if (json.has("_molecularFormula"))
29074      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
29075    Type amount = parseType("amount", json);
29076    if (amount != null)
29077      res.setAmount(amount);
29078  }
29079
29080  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(
29081      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29082    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
29083    parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(json, owner, res);
29084    return res;
29085  }
29086
29087  protected void parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(JsonObject json,
29088      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationPropertyComponent res)
29089      throws IOException, FHIRFormatError {
29090    parseBackboneElementProperties(json, res);
29091    if (json.has("category"))
29092      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
29093    if (json.has("code"))
29094      res.setCode(parseCodeableConcept(getJObject(json, "code")));
29095    if (json.has("parameters"))
29096      res.setParametersElement(parseString(json.get("parameters").getAsString()));
29097    if (json.has("_parameters"))
29098      parseElementProperties(getJObject(json, "_parameters"), res.getParametersElement());
29099    Type definingSubstance = parseType("definingSubstance", json);
29100    if (definingSubstance != null)
29101      res.setDefiningSubstance(definingSubstance);
29102    Type amount = parseType("amount", json);
29103    if (amount != null)
29104      res.setAmount(amount);
29105  }
29106
29107  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(
29108      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29109    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
29110    parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(json, owner, res);
29111    return res;
29112  }
29113
29114  protected void parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(JsonObject json,
29115      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureComponent res)
29116      throws IOException, FHIRFormatError {
29117    parseBackboneElementProperties(json, res);
29118    if (json.has("stereochemistry"))
29119      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
29120    if (json.has("opticalActivity"))
29121      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
29122    if (json.has("molecularFormula"))
29123      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
29124    if (json.has("_molecularFormula"))
29125      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
29126    if (json.has("molecularFormulaByMoiety"))
29127      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
29128    if (json.has("_molecularFormulaByMoiety"))
29129      parseElementProperties(getJObject(json, "_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
29130    if (json.has("isotope")) {
29131      JsonArray array = json.getAsJsonArray("isotope");
29132      for (int i = 0; i < array.size(); i++) {
29133        res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(
29134            array.get(i).getAsJsonObject(), owner));
29135      }
29136    }
29137    ;
29138    if (json.has("molecularWeight"))
29139      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(
29140          getJObject(json, "molecularWeight"), owner));
29141    if (json.has("source")) {
29142      JsonArray array = json.getAsJsonArray("source");
29143      for (int i = 0; i < array.size(); i++) {
29144        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
29145      }
29146    }
29147    ;
29148    if (json.has("representation")) {
29149      JsonArray array = json.getAsJsonArray("representation");
29150      for (int i = 0; i < array.size(); i++) {
29151        res.getRepresentation().add(parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(
29152            array.get(i).getAsJsonObject(), owner));
29153      }
29154    }
29155    ;
29156  }
29157
29158  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(
29159      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29160    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
29161    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(json, owner, res);
29162    return res;
29163  }
29164
29165  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(JsonObject json,
29166      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res)
29167      throws IOException, FHIRFormatError {
29168    parseBackboneElementProperties(json, res);
29169    if (json.has("identifier"))
29170      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
29171    if (json.has("name"))
29172      res.setName(parseCodeableConcept(getJObject(json, "name")));
29173    if (json.has("substitution"))
29174      res.setSubstitution(parseCodeableConcept(getJObject(json, "substitution")));
29175    if (json.has("halfLife"))
29176      res.setHalfLife(parseQuantity(getJObject(json, "halfLife")));
29177    if (json.has("molecularWeight"))
29178      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(
29179          getJObject(json, "molecularWeight"), owner));
29180  }
29181
29182  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(
29183      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29184    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
29185    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(json, owner,
29186        res);
29187    return res;
29188  }
29189
29190  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(
29191      JsonObject json, SubstanceSpecification owner,
29192      SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res)
29193      throws IOException, FHIRFormatError {
29194    parseBackboneElementProperties(json, res);
29195    if (json.has("method"))
29196      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
29197    if (json.has("type"))
29198      res.setType(parseCodeableConcept(getJObject(json, "type")));
29199    if (json.has("amount"))
29200      res.setAmount(parseQuantity(getJObject(json, "amount")));
29201  }
29202
29203  protected SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(
29204      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29205    SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent();
29206    parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(json, owner, res);
29207    return res;
29208  }
29209
29210  protected void parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(
29211      JsonObject json, SubstanceSpecification owner,
29212      SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res)
29213      throws IOException, FHIRFormatError {
29214    parseBackboneElementProperties(json, res);
29215    if (json.has("type"))
29216      res.setType(parseCodeableConcept(getJObject(json, "type")));
29217    if (json.has("representation"))
29218      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
29219    if (json.has("_representation"))
29220      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
29221    if (json.has("attachment"))
29222      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
29223  }
29224
29225  protected SubstanceSpecification.SubstanceSpecificationCodeComponent parseSubstanceSpecificationSubstanceSpecificationCodeComponent(
29226      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29227    SubstanceSpecification.SubstanceSpecificationCodeComponent res = new SubstanceSpecification.SubstanceSpecificationCodeComponent();
29228    parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(json, owner, res);
29229    return res;
29230  }
29231
29232  protected void parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(JsonObject json,
29233      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationCodeComponent res)
29234      throws IOException, FHIRFormatError {
29235    parseBackboneElementProperties(json, res);
29236    if (json.has("code"))
29237      res.setCode(parseCodeableConcept(getJObject(json, "code")));
29238    if (json.has("status"))
29239      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
29240    if (json.has("statusDate"))
29241      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
29242    if (json.has("_statusDate"))
29243      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
29244    if (json.has("comment"))
29245      res.setCommentElement(parseString(json.get("comment").getAsString()));
29246    if (json.has("_comment"))
29247      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
29248    if (json.has("source")) {
29249      JsonArray array = json.getAsJsonArray("source");
29250      for (int i = 0; i < array.size(); i++) {
29251        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
29252      }
29253    }
29254    ;
29255  }
29256
29257  protected SubstanceSpecification.SubstanceSpecificationNameComponent parseSubstanceSpecificationSubstanceSpecificationNameComponent(
29258      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29259    SubstanceSpecification.SubstanceSpecificationNameComponent res = new SubstanceSpecification.SubstanceSpecificationNameComponent();
29260    parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(json, owner, res);
29261    return res;
29262  }
29263
29264  protected void parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(JsonObject json,
29265      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameComponent res)
29266      throws IOException, FHIRFormatError {
29267    parseBackboneElementProperties(json, res);
29268    if (json.has("name"))
29269      res.setNameElement(parseString(json.get("name").getAsString()));
29270    if (json.has("_name"))
29271      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
29272    if (json.has("type"))
29273      res.setType(parseCodeableConcept(getJObject(json, "type")));
29274    if (json.has("status"))
29275      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
29276    if (json.has("preferred"))
29277      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
29278    if (json.has("_preferred"))
29279      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
29280    if (json.has("language")) {
29281      JsonArray array = json.getAsJsonArray("language");
29282      for (int i = 0; i < array.size(); i++) {
29283        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29284      }
29285    }
29286    ;
29287    if (json.has("domain")) {
29288      JsonArray array = json.getAsJsonArray("domain");
29289      for (int i = 0; i < array.size(); i++) {
29290        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29291      }
29292    }
29293    ;
29294    if (json.has("jurisdiction")) {
29295      JsonArray array = json.getAsJsonArray("jurisdiction");
29296      for (int i = 0; i < array.size(); i++) {
29297        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29298      }
29299    }
29300    ;
29301    if (json.has("synonym")) {
29302      JsonArray array = json.getAsJsonArray("synonym");
29303      for (int i = 0; i < array.size(); i++) {
29304        res.getSynonym()
29305            .add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
29306      }
29307    }
29308    ;
29309    if (json.has("translation")) {
29310      JsonArray array = json.getAsJsonArray("translation");
29311      for (int i = 0; i < array.size(); i++) {
29312        res.getTranslation()
29313            .add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
29314      }
29315    }
29316    ;
29317    if (json.has("official")) {
29318      JsonArray array = json.getAsJsonArray("official");
29319      for (int i = 0; i < array.size(); i++) {
29320        res.getOfficial().add(parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(
29321            array.get(i).getAsJsonObject(), owner));
29322      }
29323    }
29324    ;
29325    if (json.has("source")) {
29326      JsonArray array = json.getAsJsonArray("source");
29327      for (int i = 0; i < array.size(); i++) {
29328        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
29329      }
29330    }
29331    ;
29332  }
29333
29334  protected SubstanceSpecification.SubstanceSpecificationNameOfficialComponent parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(
29335      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29336    SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res = new SubstanceSpecification.SubstanceSpecificationNameOfficialComponent();
29337    parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(json, owner, res);
29338    return res;
29339  }
29340
29341  protected void parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(JsonObject json,
29342      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res)
29343      throws IOException, FHIRFormatError {
29344    parseBackboneElementProperties(json, res);
29345    if (json.has("authority"))
29346      res.setAuthority(parseCodeableConcept(getJObject(json, "authority")));
29347    if (json.has("status"))
29348      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
29349    if (json.has("date"))
29350      res.setDateElement(parseDateTime(json.get("date").getAsString()));
29351    if (json.has("_date"))
29352      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
29353  }
29354
29355  protected SubstanceSpecification.SubstanceSpecificationRelationshipComponent parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(
29356      JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
29357    SubstanceSpecification.SubstanceSpecificationRelationshipComponent res = new SubstanceSpecification.SubstanceSpecificationRelationshipComponent();
29358    parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(json, owner, res);
29359    return res;
29360  }
29361
29362  protected void parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(JsonObject json,
29363      SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationRelationshipComponent res)
29364      throws IOException, FHIRFormatError {
29365    parseBackboneElementProperties(json, res);
29366    Type substance = parseType("substance", json);
29367    if (substance != null)
29368      res.setSubstance(substance);
29369    if (json.has("relationship"))
29370      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
29371    if (json.has("isDefining"))
29372      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
29373    if (json.has("_isDefining"))
29374      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
29375    Type amount = parseType("amount", json);
29376    if (amount != null)
29377      res.setAmount(amount);
29378    if (json.has("amountRatioLowLimit"))
29379      res.setAmountRatioLowLimit(parseRatio(getJObject(json, "amountRatioLowLimit")));
29380    if (json.has("amountType"))
29381      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
29382    if (json.has("source")) {
29383      JsonArray array = json.getAsJsonArray("source");
29384      for (int i = 0; i < array.size(); i++) {
29385        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
29386      }
29387    }
29388    ;
29389  }
29390
29391  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
29392    SupplyDelivery res = new SupplyDelivery();
29393    parseSupplyDeliveryProperties(json, res);
29394    return res;
29395  }
29396
29397  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res)
29398      throws IOException, FHIRFormatError {
29399    parseDomainResourceProperties(json, res);
29400    if (json.has("identifier")) {
29401      JsonArray array = json.getAsJsonArray("identifier");
29402      for (int i = 0; i < array.size(); i++) {
29403        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
29404      }
29405    }
29406    ;
29407    if (json.has("basedOn")) {
29408      JsonArray array = json.getAsJsonArray("basedOn");
29409      for (int i = 0; i < array.size(); i++) {
29410        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
29411      }
29412    }
29413    ;
29414    if (json.has("partOf")) {
29415      JsonArray array = json.getAsJsonArray("partOf");
29416      for (int i = 0; i < array.size(); i++) {
29417        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
29418      }
29419    }
29420    ;
29421    if (json.has("status"))
29422      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL,
29423          new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
29424    if (json.has("_status"))
29425      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29426    if (json.has("patient"))
29427      res.setPatient(parseReference(getJObject(json, "patient")));
29428    if (json.has("type"))
29429      res.setType(parseCodeableConcept(getJObject(json, "type")));
29430    if (json.has("suppliedItem"))
29431      res.setSuppliedItem(
29432          parseSupplyDeliverySupplyDeliverySuppliedItemComponent(getJObject(json, "suppliedItem"), res));
29433    Type occurrence = parseType("occurrence", json);
29434    if (occurrence != null)
29435      res.setOccurrence(occurrence);
29436    if (json.has("supplier"))
29437      res.setSupplier(parseReference(getJObject(json, "supplier")));
29438    if (json.has("destination"))
29439      res.setDestination(parseReference(getJObject(json, "destination")));
29440    if (json.has("receiver")) {
29441      JsonArray array = json.getAsJsonArray("receiver");
29442      for (int i = 0; i < array.size(); i++) {
29443        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
29444      }
29445    }
29446    ;
29447  }
29448
29449  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(
29450      JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
29451    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
29452    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
29453    return res;
29454  }
29455
29456  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner,
29457      SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
29458    parseBackboneElementProperties(json, res);
29459    if (json.has("quantity"))
29460      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
29461    Type item = parseType("item", json);
29462    if (item != null)
29463      res.setItem(item);
29464  }
29465
29466  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
29467    SupplyRequest res = new SupplyRequest();
29468    parseSupplyRequestProperties(json, res);
29469    return res;
29470  }
29471
29472  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
29473    parseDomainResourceProperties(json, res);
29474    if (json.has("identifier")) {
29475      JsonArray array = json.getAsJsonArray("identifier");
29476      for (int i = 0; i < array.size(); i++) {
29477        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
29478      }
29479    }
29480    ;
29481    if (json.has("status"))
29482      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL,
29483          new SupplyRequest.SupplyRequestStatusEnumFactory()));
29484    if (json.has("_status"))
29485      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29486    if (json.has("category"))
29487      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
29488    if (json.has("priority"))
29489      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL,
29490          new SupplyRequest.RequestPriorityEnumFactory()));
29491    if (json.has("_priority"))
29492      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
29493    Type item = parseType("item", json);
29494    if (item != null)
29495      res.setItem(item);
29496    if (json.has("quantity"))
29497      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
29498    if (json.has("parameter")) {
29499      JsonArray array = json.getAsJsonArray("parameter");
29500      for (int i = 0; i < array.size(); i++) {
29501        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
29502      }
29503    }
29504    ;
29505    Type occurrence = parseType("occurrence", json);
29506    if (occurrence != null)
29507      res.setOccurrence(occurrence);
29508    if (json.has("authoredOn"))
29509      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
29510    if (json.has("_authoredOn"))
29511      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
29512    if (json.has("requester"))
29513      res.setRequester(parseReference(getJObject(json, "requester")));
29514    if (json.has("supplier")) {
29515      JsonArray array = json.getAsJsonArray("supplier");
29516      for (int i = 0; i < array.size(); i++) {
29517        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
29518      }
29519    }
29520    ;
29521    if (json.has("reasonCode")) {
29522      JsonArray array = json.getAsJsonArray("reasonCode");
29523      for (int i = 0; i < array.size(); i++) {
29524        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29525      }
29526    }
29527    ;
29528    if (json.has("reasonReference")) {
29529      JsonArray array = json.getAsJsonArray("reasonReference");
29530      for (int i = 0; i < array.size(); i++) {
29531        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
29532      }
29533    }
29534    ;
29535    if (json.has("deliverFrom"))
29536      res.setDeliverFrom(parseReference(getJObject(json, "deliverFrom")));
29537    if (json.has("deliverTo"))
29538      res.setDeliverTo(parseReference(getJObject(json, "deliverTo")));
29539  }
29540
29541  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(
29542      JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
29543    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
29544    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
29545    return res;
29546  }
29547
29548  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner,
29549      SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
29550    parseBackboneElementProperties(json, res);
29551    if (json.has("code"))
29552      res.setCode(parseCodeableConcept(getJObject(json, "code")));
29553    Type value = parseType("value", json);
29554    if (value != null)
29555      res.setValue(value);
29556  }
29557
29558  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
29559    Task res = new Task();
29560    parseTaskProperties(json, res);
29561    return res;
29562  }
29563
29564  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
29565    parseDomainResourceProperties(json, res);
29566    if (json.has("identifier")) {
29567      JsonArray array = json.getAsJsonArray("identifier");
29568      for (int i = 0; i < array.size(); i++) {
29569        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
29570      }
29571    }
29572    ;
29573    if (json.has("instantiatesCanonical"))
29574      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
29575    if (json.has("_instantiatesCanonical"))
29576      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
29577    if (json.has("instantiatesUri"))
29578      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
29579    if (json.has("_instantiatesUri"))
29580      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
29581    if (json.has("basedOn")) {
29582      JsonArray array = json.getAsJsonArray("basedOn");
29583      for (int i = 0; i < array.size(); i++) {
29584        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
29585      }
29586    }
29587    ;
29588    if (json.has("groupIdentifier"))
29589      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
29590    if (json.has("partOf")) {
29591      JsonArray array = json.getAsJsonArray("partOf");
29592      for (int i = 0; i < array.size(); i++) {
29593        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
29594      }
29595    }
29596    ;
29597    if (json.has("status"))
29598      res.setStatusElement(
29599          parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
29600    if (json.has("_status"))
29601      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29602    if (json.has("statusReason"))
29603      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
29604    if (json.has("businessStatus"))
29605      res.setBusinessStatus(parseCodeableConcept(getJObject(json, "businessStatus")));
29606    if (json.has("intent"))
29607      res.setIntentElement(
29608          parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
29609    if (json.has("_intent"))
29610      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
29611    if (json.has("priority"))
29612      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL,
29613          new Task.TaskPriorityEnumFactory()));
29614    if (json.has("_priority"))
29615      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
29616    if (json.has("code"))
29617      res.setCode(parseCodeableConcept(getJObject(json, "code")));
29618    if (json.has("description"))
29619      res.setDescriptionElement(parseString(json.get("description").getAsString()));
29620    if (json.has("_description"))
29621      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29622    if (json.has("focus"))
29623      res.setFocus(parseReference(getJObject(json, "focus")));
29624    if (json.has("for"))
29625      res.setFor(parseReference(getJObject(json, "for")));
29626    if (json.has("encounter"))
29627      res.setEncounter(parseReference(getJObject(json, "encounter")));
29628    if (json.has("executionPeriod"))
29629      res.setExecutionPeriod(parsePeriod(getJObject(json, "executionPeriod")));
29630    if (json.has("authoredOn"))
29631      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
29632    if (json.has("_authoredOn"))
29633      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
29634    if (json.has("lastModified"))
29635      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
29636    if (json.has("_lastModified"))
29637      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
29638    if (json.has("requester"))
29639      res.setRequester(parseReference(getJObject(json, "requester")));
29640    if (json.has("performerType")) {
29641      JsonArray array = json.getAsJsonArray("performerType");
29642      for (int i = 0; i < array.size(); i++) {
29643        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29644      }
29645    }
29646    ;
29647    if (json.has("owner"))
29648      res.setOwner(parseReference(getJObject(json, "owner")));
29649    if (json.has("location"))
29650      res.setLocation(parseReference(getJObject(json, "location")));
29651    if (json.has("reasonCode"))
29652      res.setReasonCode(parseCodeableConcept(getJObject(json, "reasonCode")));
29653    if (json.has("reasonReference"))
29654      res.setReasonReference(parseReference(getJObject(json, "reasonReference")));
29655    if (json.has("insurance")) {
29656      JsonArray array = json.getAsJsonArray("insurance");
29657      for (int i = 0; i < array.size(); i++) {
29658        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
29659      }
29660    }
29661    ;
29662    if (json.has("note")) {
29663      JsonArray array = json.getAsJsonArray("note");
29664      for (int i = 0; i < array.size(); i++) {
29665        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
29666      }
29667    }
29668    ;
29669    if (json.has("relevantHistory")) {
29670      JsonArray array = json.getAsJsonArray("relevantHistory");
29671      for (int i = 0; i < array.size(); i++) {
29672        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
29673      }
29674    }
29675    ;
29676    if (json.has("restriction"))
29677      res.setRestriction(parseTaskTaskRestrictionComponent(getJObject(json, "restriction"), res));
29678    if (json.has("input")) {
29679      JsonArray array = json.getAsJsonArray("input");
29680      for (int i = 0; i < array.size(); i++) {
29681        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
29682      }
29683    }
29684    ;
29685    if (json.has("output")) {
29686      JsonArray array = json.getAsJsonArray("output");
29687      for (int i = 0; i < array.size(); i++) {
29688        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
29689      }
29690    }
29691    ;
29692  }
29693
29694  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner)
29695      throws IOException, FHIRFormatError {
29696    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
29697    parseTaskTaskRestrictionComponentProperties(json, owner, res);
29698    return res;
29699  }
29700
29701  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner,
29702      Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
29703    parseBackboneElementProperties(json, res);
29704    if (json.has("repetitions"))
29705      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
29706    if (json.has("_repetitions"))
29707      parseElementProperties(getJObject(json, "_repetitions"), res.getRepetitionsElement());
29708    if (json.has("period"))
29709      res.setPeriod(parsePeriod(getJObject(json, "period")));
29710    if (json.has("recipient")) {
29711      JsonArray array = json.getAsJsonArray("recipient");
29712      for (int i = 0; i < array.size(); i++) {
29713        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
29714      }
29715    }
29716    ;
29717  }
29718
29719  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner)
29720      throws IOException, FHIRFormatError {
29721    Task.ParameterComponent res = new Task.ParameterComponent();
29722    parseTaskParameterComponentProperties(json, owner, res);
29723    return res;
29724  }
29725
29726  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res)
29727      throws IOException, FHIRFormatError {
29728    parseBackboneElementProperties(json, res);
29729    if (json.has("type"))
29730      res.setType(parseCodeableConcept(getJObject(json, "type")));
29731    Type value = parseType("value", json);
29732    if (value != null)
29733      res.setValue(value);
29734  }
29735
29736  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner)
29737      throws IOException, FHIRFormatError {
29738    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
29739    parseTaskTaskOutputComponentProperties(json, owner, res);
29740    return res;
29741  }
29742
29743  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res)
29744      throws IOException, FHIRFormatError {
29745    parseBackboneElementProperties(json, res);
29746    if (json.has("type"))
29747      res.setType(parseCodeableConcept(getJObject(json, "type")));
29748    Type value = parseType("value", json);
29749    if (value != null)
29750      res.setValue(value);
29751  }
29752
29753  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
29754    TerminologyCapabilities res = new TerminologyCapabilities();
29755    parseTerminologyCapabilitiesProperties(json, res);
29756    return res;
29757  }
29758
29759  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res)
29760      throws IOException, FHIRFormatError {
29761    parseDomainResourceProperties(json, res);
29762    if (json.has("url"))
29763      res.setUrlElement(parseUri(json.get("url").getAsString()));
29764    if (json.has("_url"))
29765      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
29766    if (json.has("version"))
29767      res.setVersionElement(parseString(json.get("version").getAsString()));
29768    if (json.has("_version"))
29769      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
29770    if (json.has("name"))
29771      res.setNameElement(parseString(json.get("name").getAsString()));
29772    if (json.has("_name"))
29773      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
29774    if (json.has("title"))
29775      res.setTitleElement(parseString(json.get("title").getAsString()));
29776    if (json.has("_title"))
29777      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
29778    if (json.has("status"))
29779      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
29780          new Enumerations.PublicationStatusEnumFactory()));
29781    if (json.has("_status"))
29782      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
29783    if (json.has("experimental"))
29784      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
29785    if (json.has("_experimental"))
29786      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
29787    if (json.has("date"))
29788      res.setDateElement(parseDateTime(json.get("date").getAsString()));
29789    if (json.has("_date"))
29790      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
29791    if (json.has("publisher"))
29792      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
29793    if (json.has("_publisher"))
29794      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
29795    if (json.has("contact")) {
29796      JsonArray array = json.getAsJsonArray("contact");
29797      for (int i = 0; i < array.size(); i++) {
29798        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
29799      }
29800    }
29801    ;
29802    if (json.has("description"))
29803      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
29804    if (json.has("_description"))
29805      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29806    if (json.has("useContext")) {
29807      JsonArray array = json.getAsJsonArray("useContext");
29808      for (int i = 0; i < array.size(); i++) {
29809        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
29810      }
29811    }
29812    ;
29813    if (json.has("jurisdiction")) {
29814      JsonArray array = json.getAsJsonArray("jurisdiction");
29815      for (int i = 0; i < array.size(); i++) {
29816        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
29817      }
29818    }
29819    ;
29820    if (json.has("purpose"))
29821      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
29822    if (json.has("_purpose"))
29823      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
29824    if (json.has("copyright"))
29825      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
29826    if (json.has("_copyright"))
29827      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
29828    if (json.has("kind"))
29829      res.setKindElement(
29830          parseEnumeration(json.get("kind").getAsString(), TerminologyCapabilities.CapabilityStatementKind.NULL,
29831              new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
29832    if (json.has("_kind"))
29833      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
29834    if (json.has("software"))
29835      res.setSoftware(
29836          parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(getJObject(json, "software"), res));
29837    if (json.has("implementation"))
29838      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(
29839          getJObject(json, "implementation"), res));
29840    if (json.has("lockedDate"))
29841      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
29842    if (json.has("_lockedDate"))
29843      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
29844    if (json.has("codeSystem")) {
29845      JsonArray array = json.getAsJsonArray("codeSystem");
29846      for (int i = 0; i < array.size(); i++) {
29847        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(
29848            array.get(i).getAsJsonObject(), res));
29849      }
29850    }
29851    ;
29852    if (json.has("expansion"))
29853      res.setExpansion(
29854          parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(getJObject(json, "expansion"), res));
29855    if (json.has("codeSearch"))
29856      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(),
29857          TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
29858    if (json.has("_codeSearch"))
29859      parseElementProperties(getJObject(json, "_codeSearch"), res.getCodeSearchElement());
29860    if (json.has("validateCode"))
29861      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(
29862          getJObject(json, "validateCode"), res));
29863    if (json.has("translation"))
29864      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(
29865          getJObject(json, "translation"), res));
29866    if (json.has("closure"))
29867      res.setClosure(
29868          parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(getJObject(json, "closure"), res));
29869  }
29870
29871  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(
29872      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
29873    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
29874    parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(json, owner, res);
29875    return res;
29876  }
29877
29878  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json,
29879      TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res)
29880      throws IOException, FHIRFormatError {
29881    parseBackboneElementProperties(json, res);
29882    if (json.has("name"))
29883      res.setNameElement(parseString(json.get("name").getAsString()));
29884    if (json.has("_name"))
29885      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
29886    if (json.has("version"))
29887      res.setVersionElement(parseString(json.get("version").getAsString()));
29888    if (json.has("_version"))
29889      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
29890  }
29891
29892  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(
29893      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
29894    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
29895    parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(json, owner, res);
29896    return res;
29897  }
29898
29899  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(JsonObject json,
29900      TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res)
29901      throws IOException, FHIRFormatError {
29902    parseBackboneElementProperties(json, res);
29903    if (json.has("description"))
29904      res.setDescriptionElement(parseString(json.get("description").getAsString()));
29905    if (json.has("_description"))
29906      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
29907    if (json.has("url"))
29908      res.setUrlElement(parseUrl(json.get("url").getAsString()));
29909    if (json.has("_url"))
29910      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
29911  }
29912
29913  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(
29914      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
29915    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
29916    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
29917    return res;
29918  }
29919
29920  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json,
29921      TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res)
29922      throws IOException, FHIRFormatError {
29923    parseBackboneElementProperties(json, res);
29924    if (json.has("uri"))
29925      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
29926    if (json.has("_uri"))
29927      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
29928    if (json.has("version")) {
29929      JsonArray array = json.getAsJsonArray("version");
29930      for (int i = 0; i < array.size(); i++) {
29931        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(
29932            array.get(i).getAsJsonObject(), owner));
29933      }
29934    }
29935    ;
29936    if (json.has("subsumption"))
29937      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
29938    if (json.has("_subsumption"))
29939      parseElementProperties(getJObject(json, "_subsumption"), res.getSubsumptionElement());
29940  }
29941
29942  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(
29943      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
29944    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
29945    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
29946    return res;
29947  }
29948
29949  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(
29950      JsonObject json, TerminologyCapabilities owner,
29951      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res)
29952      throws IOException, FHIRFormatError {
29953    parseBackboneElementProperties(json, res);
29954    if (json.has("code"))
29955      res.setCodeElement(parseString(json.get("code").getAsString()));
29956    if (json.has("_code"))
29957      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
29958    if (json.has("isDefault"))
29959      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
29960    if (json.has("_isDefault"))
29961      parseElementProperties(getJObject(json, "_isDefault"), res.getIsDefaultElement());
29962    if (json.has("compositional"))
29963      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
29964    if (json.has("_compositional"))
29965      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
29966    if (json.has("language")) {
29967      JsonArray array = json.getAsJsonArray("language");
29968      for (int i = 0; i < array.size(); i++) {
29969        if (array.get(i).isJsonNull()) {
29970          res.getLanguage().add(new CodeType());
29971        } else {
29972          res.getLanguage().add(parseCode(array.get(i).getAsString()));
29973        }
29974      }
29975    }
29976    ;
29977    if (json.has("_language")) {
29978      JsonArray array = json.getAsJsonArray("_language");
29979      for (int i = 0; i < array.size(); i++) {
29980        if (i == res.getLanguage().size())
29981          res.getLanguage().add(parseCode(null));
29982        if (array.get(i) instanceof JsonObject)
29983          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
29984      }
29985    }
29986    ;
29987    if (json.has("filter")) {
29988      JsonArray array = json.getAsJsonArray("filter");
29989      for (int i = 0; i < array.size(); i++) {
29990        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(
29991            array.get(i).getAsJsonObject(), owner));
29992      }
29993    }
29994    ;
29995    if (json.has("property")) {
29996      JsonArray array = json.getAsJsonArray("property");
29997      for (int i = 0; i < array.size(); i++) {
29998        if (array.get(i).isJsonNull()) {
29999          res.getProperty().add(new CodeType());
30000        } else {
30001          res.getProperty().add(parseCode(array.get(i).getAsString()));
30002        }
30003      }
30004    }
30005    ;
30006    if (json.has("_property")) {
30007      JsonArray array = json.getAsJsonArray("_property");
30008      for (int i = 0; i < array.size(); i++) {
30009        if (i == res.getProperty().size())
30010          res.getProperty().add(parseCode(null));
30011        if (array.get(i) instanceof JsonObject)
30012          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
30013      }
30014    }
30015    ;
30016  }
30017
30018  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(
30019      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
30020    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
30021    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
30022    return res;
30023  }
30024
30025  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(
30026      JsonObject json, TerminologyCapabilities owner,
30027      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res)
30028      throws IOException, FHIRFormatError {
30029    parseBackboneElementProperties(json, res);
30030    if (json.has("code"))
30031      res.setCodeElement(parseCode(json.get("code").getAsString()));
30032    if (json.has("_code"))
30033      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
30034    if (json.has("op")) {
30035      JsonArray array = json.getAsJsonArray("op");
30036      for (int i = 0; i < array.size(); i++) {
30037        if (array.get(i).isJsonNull()) {
30038          res.getOp().add(new CodeType());
30039        } else {
30040          res.getOp().add(parseCode(array.get(i).getAsString()));
30041        }
30042      }
30043    }
30044    ;
30045    if (json.has("_op")) {
30046      JsonArray array = json.getAsJsonArray("_op");
30047      for (int i = 0; i < array.size(); i++) {
30048        if (i == res.getOp().size())
30049          res.getOp().add(parseCode(null));
30050        if (array.get(i) instanceof JsonObject)
30051          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
30052      }
30053    }
30054    ;
30055  }
30056
30057  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(
30058      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
30059    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
30060    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
30061    return res;
30062  }
30063
30064  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json,
30065      TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res)
30066      throws IOException, FHIRFormatError {
30067    parseBackboneElementProperties(json, res);
30068    if (json.has("hierarchical"))
30069      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
30070    if (json.has("_hierarchical"))
30071      parseElementProperties(getJObject(json, "_hierarchical"), res.getHierarchicalElement());
30072    if (json.has("paging"))
30073      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
30074    if (json.has("_paging"))
30075      parseElementProperties(getJObject(json, "_paging"), res.getPagingElement());
30076    if (json.has("incomplete"))
30077      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
30078    if (json.has("_incomplete"))
30079      parseElementProperties(getJObject(json, "_incomplete"), res.getIncompleteElement());
30080    if (json.has("parameter")) {
30081      JsonArray array = json.getAsJsonArray("parameter");
30082      for (int i = 0; i < array.size(); i++) {
30083        res.getParameter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(
30084            array.get(i).getAsJsonObject(), owner));
30085      }
30086    }
30087    ;
30088    if (json.has("textFilter"))
30089      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
30090    if (json.has("_textFilter"))
30091      parseElementProperties(getJObject(json, "_textFilter"), res.getTextFilterElement());
30092  }
30093
30094  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(
30095      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
30096    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
30097    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(json, owner, res);
30098    return res;
30099  }
30100
30101  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(
30102      JsonObject json, TerminologyCapabilities owner,
30103      TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res)
30104      throws IOException, FHIRFormatError {
30105    parseBackboneElementProperties(json, res);
30106    if (json.has("name"))
30107      res.setNameElement(parseCode(json.get("name").getAsString()));
30108    if (json.has("_name"))
30109      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30110    if (json.has("documentation"))
30111      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
30112    if (json.has("_documentation"))
30113      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
30114  }
30115
30116  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(
30117      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
30118    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
30119    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
30120    return res;
30121  }
30122
30123  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json,
30124      TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res)
30125      throws IOException, FHIRFormatError {
30126    parseBackboneElementProperties(json, res);
30127    if (json.has("translations"))
30128      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
30129    if (json.has("_translations"))
30130      parseElementProperties(getJObject(json, "_translations"), res.getTranslationsElement());
30131  }
30132
30133  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(
30134      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
30135    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
30136    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
30137    return res;
30138  }
30139
30140  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json,
30141      TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res)
30142      throws IOException, FHIRFormatError {
30143    parseBackboneElementProperties(json, res);
30144    if (json.has("needsMap"))
30145      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
30146    if (json.has("_needsMap"))
30147      parseElementProperties(getJObject(json, "_needsMap"), res.getNeedsMapElement());
30148  }
30149
30150  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(
30151      JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
30152    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
30153    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
30154    return res;
30155  }
30156
30157  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json,
30158      TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res)
30159      throws IOException, FHIRFormatError {
30160    parseBackboneElementProperties(json, res);
30161    if (json.has("translation"))
30162      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
30163    if (json.has("_translation"))
30164      parseElementProperties(getJObject(json, "_translation"), res.getTranslationElement());
30165  }
30166
30167  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
30168    TestReport res = new TestReport();
30169    parseTestReportProperties(json, res);
30170    return res;
30171  }
30172
30173  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
30174    parseDomainResourceProperties(json, res);
30175    if (json.has("identifier"))
30176      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
30177    if (json.has("name"))
30178      res.setNameElement(parseString(json.get("name").getAsString()));
30179    if (json.has("_name"))
30180      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30181    if (json.has("status"))
30182      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL,
30183          new TestReport.TestReportStatusEnumFactory()));
30184    if (json.has("_status"))
30185      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
30186    if (json.has("testScript"))
30187      res.setTestScript(parseReference(getJObject(json, "testScript")));
30188    if (json.has("result"))
30189      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL,
30190          new TestReport.TestReportResultEnumFactory()));
30191    if (json.has("_result"))
30192      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
30193    if (json.has("score"))
30194      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
30195    if (json.has("_score"))
30196      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
30197    if (json.has("tester"))
30198      res.setTesterElement(parseString(json.get("tester").getAsString()));
30199    if (json.has("_tester"))
30200      parseElementProperties(getJObject(json, "_tester"), res.getTesterElement());
30201    if (json.has("issued"))
30202      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
30203    if (json.has("_issued"))
30204      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
30205    if (json.has("participant")) {
30206      JsonArray array = json.getAsJsonArray("participant");
30207      for (int i = 0; i < array.size(); i++) {
30208        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
30209      }
30210    }
30211    ;
30212    if (json.has("setup"))
30213      res.setSetup(parseTestReportTestReportSetupComponent(getJObject(json, "setup"), res));
30214    if (json.has("test")) {
30215      JsonArray array = json.getAsJsonArray("test");
30216      for (int i = 0; i < array.size(); i++) {
30217        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
30218      }
30219    }
30220    ;
30221    if (json.has("teardown"))
30222      res.setTeardown(parseTestReportTestReportTeardownComponent(getJObject(json, "teardown"), res));
30223  }
30224
30225  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json,
30226      TestReport owner) throws IOException, FHIRFormatError {
30227    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
30228    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
30229    return res;
30230  }
30231
30232  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner,
30233      TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
30234    parseBackboneElementProperties(json, res);
30235    if (json.has("type"))
30236      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL,
30237          new TestReport.TestReportParticipantTypeEnumFactory()));
30238    if (json.has("_type"))
30239      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
30240    if (json.has("uri"))
30241      res.setUriElement(parseUri(json.get("uri").getAsString()));
30242    if (json.has("_uri"))
30243      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
30244    if (json.has("display"))
30245      res.setDisplayElement(parseString(json.get("display").getAsString()));
30246    if (json.has("_display"))
30247      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
30248  }
30249
30250  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json,
30251      TestReport owner) throws IOException, FHIRFormatError {
30252    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
30253    parseTestReportTestReportSetupComponentProperties(json, owner, res);
30254    return res;
30255  }
30256
30257  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner,
30258      TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
30259    parseBackboneElementProperties(json, res);
30260    if (json.has("action")) {
30261      JsonArray array = json.getAsJsonArray("action");
30262      for (int i = 0; i < array.size(); i++) {
30263        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
30264      }
30265    }
30266    ;
30267  }
30268
30269  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner)
30270      throws IOException, FHIRFormatError {
30271    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
30272    parseTestReportSetupActionComponentProperties(json, owner, res);
30273    return res;
30274  }
30275
30276  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner,
30277      TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
30278    parseBackboneElementProperties(json, res);
30279    if (json.has("operation"))
30280      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
30281    if (json.has("assert"))
30282      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
30283  }
30284
30285  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json,
30286      TestReport owner) throws IOException, FHIRFormatError {
30287    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
30288    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
30289    return res;
30290  }
30291
30292  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner,
30293      TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
30294    parseBackboneElementProperties(json, res);
30295    if (json.has("result"))
30296      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL,
30297          new TestReport.TestReportActionResultEnumFactory()));
30298    if (json.has("_result"))
30299      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
30300    if (json.has("message"))
30301      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
30302    if (json.has("_message"))
30303      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
30304    if (json.has("detail"))
30305      res.setDetailElement(parseUri(json.get("detail").getAsString()));
30306    if (json.has("_detail"))
30307      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
30308  }
30309
30310  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json,
30311      TestReport owner) throws IOException, FHIRFormatError {
30312    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
30313    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
30314    return res;
30315  }
30316
30317  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner,
30318      TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
30319    parseBackboneElementProperties(json, res);
30320    if (json.has("result"))
30321      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL,
30322          new TestReport.TestReportActionResultEnumFactory()));
30323    if (json.has("_result"))
30324      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
30325    if (json.has("message"))
30326      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
30327    if (json.has("_message"))
30328      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
30329    if (json.has("detail"))
30330      res.setDetailElement(parseString(json.get("detail").getAsString()));
30331    if (json.has("_detail"))
30332      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
30333  }
30334
30335  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner)
30336      throws IOException, FHIRFormatError {
30337    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
30338    parseTestReportTestReportTestComponentProperties(json, owner, res);
30339    return res;
30340  }
30341
30342  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner,
30343      TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
30344    parseBackboneElementProperties(json, res);
30345    if (json.has("name"))
30346      res.setNameElement(parseString(json.get("name").getAsString()));
30347    if (json.has("_name"))
30348      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30349    if (json.has("description"))
30350      res.setDescriptionElement(parseString(json.get("description").getAsString()));
30351    if (json.has("_description"))
30352      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30353    if (json.has("action")) {
30354      JsonArray array = json.getAsJsonArray("action");
30355      for (int i = 0; i < array.size(); i++) {
30356        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
30357      }
30358    }
30359    ;
30360  }
30361
30362  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner)
30363      throws IOException, FHIRFormatError {
30364    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
30365    parseTestReportTestActionComponentProperties(json, owner, res);
30366    return res;
30367  }
30368
30369  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner,
30370      TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
30371    parseBackboneElementProperties(json, res);
30372    if (json.has("operation"))
30373      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
30374    if (json.has("assert"))
30375      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
30376  }
30377
30378  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json,
30379      TestReport owner) throws IOException, FHIRFormatError {
30380    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
30381    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
30382    return res;
30383  }
30384
30385  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner,
30386      TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
30387    parseBackboneElementProperties(json, res);
30388    if (json.has("action")) {
30389      JsonArray array = json.getAsJsonArray("action");
30390      for (int i = 0; i < array.size(); i++) {
30391        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
30392      }
30393    }
30394    ;
30395  }
30396
30397  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner)
30398      throws IOException, FHIRFormatError {
30399    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
30400    parseTestReportTeardownActionComponentProperties(json, owner, res);
30401    return res;
30402  }
30403
30404  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner,
30405      TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
30406    parseBackboneElementProperties(json, res);
30407    if (json.has("operation"))
30408      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
30409  }
30410
30411  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
30412    TestScript res = new TestScript();
30413    parseTestScriptProperties(json, res);
30414    return res;
30415  }
30416
30417  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
30418    parseDomainResourceProperties(json, res);
30419    if (json.has("url"))
30420      res.setUrlElement(parseUri(json.get("url").getAsString()));
30421    if (json.has("_url"))
30422      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
30423    if (json.has("identifier"))
30424      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
30425    if (json.has("version"))
30426      res.setVersionElement(parseString(json.get("version").getAsString()));
30427    if (json.has("_version"))
30428      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
30429    if (json.has("name"))
30430      res.setNameElement(parseString(json.get("name").getAsString()));
30431    if (json.has("_name"))
30432      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30433    if (json.has("title"))
30434      res.setTitleElement(parseString(json.get("title").getAsString()));
30435    if (json.has("_title"))
30436      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
30437    if (json.has("status"))
30438      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
30439          new Enumerations.PublicationStatusEnumFactory()));
30440    if (json.has("_status"))
30441      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
30442    if (json.has("experimental"))
30443      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
30444    if (json.has("_experimental"))
30445      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
30446    if (json.has("date"))
30447      res.setDateElement(parseDateTime(json.get("date").getAsString()));
30448    if (json.has("_date"))
30449      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
30450    if (json.has("publisher"))
30451      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
30452    if (json.has("_publisher"))
30453      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
30454    if (json.has("contact")) {
30455      JsonArray array = json.getAsJsonArray("contact");
30456      for (int i = 0; i < array.size(); i++) {
30457        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
30458      }
30459    }
30460    ;
30461    if (json.has("description"))
30462      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
30463    if (json.has("_description"))
30464      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30465    if (json.has("useContext")) {
30466      JsonArray array = json.getAsJsonArray("useContext");
30467      for (int i = 0; i < array.size(); i++) {
30468        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
30469      }
30470    }
30471    ;
30472    if (json.has("jurisdiction")) {
30473      JsonArray array = json.getAsJsonArray("jurisdiction");
30474      for (int i = 0; i < array.size(); i++) {
30475        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
30476      }
30477    }
30478    ;
30479    if (json.has("purpose"))
30480      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
30481    if (json.has("_purpose"))
30482      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
30483    if (json.has("copyright"))
30484      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
30485    if (json.has("_copyright"))
30486      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
30487    if (json.has("origin")) {
30488      JsonArray array = json.getAsJsonArray("origin");
30489      for (int i = 0; i < array.size(); i++) {
30490        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
30491      }
30492    }
30493    ;
30494    if (json.has("destination")) {
30495      JsonArray array = json.getAsJsonArray("destination");
30496      for (int i = 0; i < array.size(); i++) {
30497        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
30498      }
30499    }
30500    ;
30501    if (json.has("metadata"))
30502      res.setMetadata(parseTestScriptTestScriptMetadataComponent(getJObject(json, "metadata"), res));
30503    if (json.has("fixture")) {
30504      JsonArray array = json.getAsJsonArray("fixture");
30505      for (int i = 0; i < array.size(); i++) {
30506        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
30507      }
30508    }
30509    ;
30510    if (json.has("profile")) {
30511      JsonArray array = json.getAsJsonArray("profile");
30512      for (int i = 0; i < array.size(); i++) {
30513        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
30514      }
30515    }
30516    ;
30517    if (json.has("variable")) {
30518      JsonArray array = json.getAsJsonArray("variable");
30519      for (int i = 0; i < array.size(); i++) {
30520        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
30521      }
30522    }
30523    ;
30524    if (json.has("setup"))
30525      res.setSetup(parseTestScriptTestScriptSetupComponent(getJObject(json, "setup"), res));
30526    if (json.has("test")) {
30527      JsonArray array = json.getAsJsonArray("test");
30528      for (int i = 0; i < array.size(); i++) {
30529        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
30530      }
30531    }
30532    ;
30533    if (json.has("teardown"))
30534      res.setTeardown(parseTestScriptTestScriptTeardownComponent(getJObject(json, "teardown"), res));
30535  }
30536
30537  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json,
30538      TestScript owner) throws IOException, FHIRFormatError {
30539    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
30540    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
30541    return res;
30542  }
30543
30544  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner,
30545      TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
30546    parseBackboneElementProperties(json, res);
30547    if (json.has("index"))
30548      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
30549    if (json.has("_index"))
30550      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
30551    if (json.has("profile"))
30552      res.setProfile(parseCoding(getJObject(json, "profile")));
30553  }
30554
30555  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json,
30556      TestScript owner) throws IOException, FHIRFormatError {
30557    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
30558    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
30559    return res;
30560  }
30561
30562  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner,
30563      TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
30564    parseBackboneElementProperties(json, res);
30565    if (json.has("index"))
30566      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
30567    if (json.has("_index"))
30568      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
30569    if (json.has("profile"))
30570      res.setProfile(parseCoding(getJObject(json, "profile")));
30571  }
30572
30573  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json,
30574      TestScript owner) throws IOException, FHIRFormatError {
30575    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
30576    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
30577    return res;
30578  }
30579
30580  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner,
30581      TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
30582    parseBackboneElementProperties(json, res);
30583    if (json.has("link")) {
30584      JsonArray array = json.getAsJsonArray("link");
30585      for (int i = 0; i < array.size(); i++) {
30586        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
30587      }
30588    }
30589    ;
30590    if (json.has("capability")) {
30591      JsonArray array = json.getAsJsonArray("capability");
30592      for (int i = 0; i < array.size(); i++) {
30593        res.getCapability()
30594            .add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
30595      }
30596    }
30597    ;
30598  }
30599
30600  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json,
30601      TestScript owner) throws IOException, FHIRFormatError {
30602    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
30603    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
30604    return res;
30605  }
30606
30607  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner,
30608      TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
30609    parseBackboneElementProperties(json, res);
30610    if (json.has("url"))
30611      res.setUrlElement(parseUri(json.get("url").getAsString()));
30612    if (json.has("_url"))
30613      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
30614    if (json.has("description"))
30615      res.setDescriptionElement(parseString(json.get("description").getAsString()));
30616    if (json.has("_description"))
30617      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30618  }
30619
30620  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(
30621      JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
30622    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
30623    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
30624    return res;
30625  }
30626
30627  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner,
30628      TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
30629    parseBackboneElementProperties(json, res);
30630    if (json.has("required"))
30631      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
30632    if (json.has("_required"))
30633      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
30634    if (json.has("validated"))
30635      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
30636    if (json.has("_validated"))
30637      parseElementProperties(getJObject(json, "_validated"), res.getValidatedElement());
30638    if (json.has("description"))
30639      res.setDescriptionElement(parseString(json.get("description").getAsString()));
30640    if (json.has("_description"))
30641      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30642    if (json.has("origin")) {
30643      JsonArray array = json.getAsJsonArray("origin");
30644      for (int i = 0; i < array.size(); i++) {
30645        if (array.get(i).isJsonNull()) {
30646          res.getOrigin().add(new IntegerType());
30647        } else {
30648          res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
30649        }
30650      }
30651    }
30652    ;
30653    if (json.has("_origin")) {
30654      JsonArray array = json.getAsJsonArray("_origin");
30655      for (int i = 0; i < array.size(); i++) {
30656        if (i == res.getOrigin().size())
30657          res.getOrigin().add(parseInteger(null));
30658        if (array.get(i) instanceof JsonObject)
30659          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
30660      }
30661    }
30662    ;
30663    if (json.has("destination"))
30664      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
30665    if (json.has("_destination"))
30666      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
30667    if (json.has("link")) {
30668      JsonArray array = json.getAsJsonArray("link");
30669      for (int i = 0; i < array.size(); i++) {
30670        if (array.get(i).isJsonNull()) {
30671          res.getLink().add(new UriType());
30672        } else {
30673          res.getLink().add(parseUri(array.get(i).getAsString()));
30674        }
30675      }
30676    }
30677    ;
30678    if (json.has("_link")) {
30679      JsonArray array = json.getAsJsonArray("_link");
30680      for (int i = 0; i < array.size(); i++) {
30681        if (i == res.getLink().size())
30682          res.getLink().add(parseUri(null));
30683        if (array.get(i) instanceof JsonObject)
30684          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
30685      }
30686    }
30687    ;
30688    if (json.has("capabilities"))
30689      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
30690    if (json.has("_capabilities"))
30691      parseElementProperties(getJObject(json, "_capabilities"), res.getCapabilitiesElement());
30692  }
30693
30694  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json,
30695      TestScript owner) throws IOException, FHIRFormatError {
30696    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
30697    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
30698    return res;
30699  }
30700
30701  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner,
30702      TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
30703    parseBackboneElementProperties(json, res);
30704    if (json.has("autocreate"))
30705      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
30706    if (json.has("_autocreate"))
30707      parseElementProperties(getJObject(json, "_autocreate"), res.getAutocreateElement());
30708    if (json.has("autodelete"))
30709      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
30710    if (json.has("_autodelete"))
30711      parseElementProperties(getJObject(json, "_autodelete"), res.getAutodeleteElement());
30712    if (json.has("resource"))
30713      res.setResource(parseReference(getJObject(json, "resource")));
30714  }
30715
30716  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json,
30717      TestScript owner) throws IOException, FHIRFormatError {
30718    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
30719    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
30720    return res;
30721  }
30722
30723  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner,
30724      TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
30725    parseBackboneElementProperties(json, res);
30726    if (json.has("name"))
30727      res.setNameElement(parseString(json.get("name").getAsString()));
30728    if (json.has("_name"))
30729      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
30730    if (json.has("defaultValue"))
30731      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
30732    if (json.has("_defaultValue"))
30733      parseElementProperties(getJObject(json, "_defaultValue"), res.getDefaultValueElement());
30734    if (json.has("description"))
30735      res.setDescriptionElement(parseString(json.get("description").getAsString()));
30736    if (json.has("_description"))
30737      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30738    if (json.has("expression"))
30739      res.setExpressionElement(parseString(json.get("expression").getAsString()));
30740    if (json.has("_expression"))
30741      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
30742    if (json.has("headerField"))
30743      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
30744    if (json.has("_headerField"))
30745      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
30746    if (json.has("hint"))
30747      res.setHintElement(parseString(json.get("hint").getAsString()));
30748    if (json.has("_hint"))
30749      parseElementProperties(getJObject(json, "_hint"), res.getHintElement());
30750    if (json.has("path"))
30751      res.setPathElement(parseString(json.get("path").getAsString()));
30752    if (json.has("_path"))
30753      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
30754    if (json.has("sourceId"))
30755      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
30756    if (json.has("_sourceId"))
30757      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
30758  }
30759
30760  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json,
30761      TestScript owner) throws IOException, FHIRFormatError {
30762    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
30763    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
30764    return res;
30765  }
30766
30767  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner,
30768      TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
30769    parseBackboneElementProperties(json, res);
30770    if (json.has("action")) {
30771      JsonArray array = json.getAsJsonArray("action");
30772      for (int i = 0; i < array.size(); i++) {
30773        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
30774      }
30775    }
30776    ;
30777  }
30778
30779  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner)
30780      throws IOException, FHIRFormatError {
30781    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
30782    parseTestScriptSetupActionComponentProperties(json, owner, res);
30783    return res;
30784  }
30785
30786  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner,
30787      TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
30788    parseBackboneElementProperties(json, res);
30789    if (json.has("operation"))
30790      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
30791    if (json.has("assert"))
30792      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
30793  }
30794
30795  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json,
30796      TestScript owner) throws IOException, FHIRFormatError {
30797    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
30798    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
30799    return res;
30800  }
30801
30802  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner,
30803      TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
30804    parseBackboneElementProperties(json, res);
30805    if (json.has("type"))
30806      res.setType(parseCoding(getJObject(json, "type")));
30807    if (json.has("resource"))
30808      res.setResourceElement(parseCode(json.get("resource").getAsString()));
30809    if (json.has("_resource"))
30810      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
30811    if (json.has("label"))
30812      res.setLabelElement(parseString(json.get("label").getAsString()));
30813    if (json.has("_label"))
30814      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
30815    if (json.has("description"))
30816      res.setDescriptionElement(parseString(json.get("description").getAsString()));
30817    if (json.has("_description"))
30818      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30819    if (json.has("accept"))
30820      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
30821    if (json.has("_accept"))
30822      parseElementProperties(getJObject(json, "_accept"), res.getAcceptElement());
30823    if (json.has("contentType"))
30824      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
30825    if (json.has("_contentType"))
30826      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
30827    if (json.has("destination"))
30828      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
30829    if (json.has("_destination"))
30830      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
30831    if (json.has("encodeRequestUrl"))
30832      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
30833    if (json.has("_encodeRequestUrl"))
30834      parseElementProperties(getJObject(json, "_encodeRequestUrl"), res.getEncodeRequestUrlElement());
30835    if (json.has("method"))
30836      res.setMethodElement(parseEnumeration(json.get("method").getAsString(),
30837          TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
30838    if (json.has("_method"))
30839      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
30840    if (json.has("origin"))
30841      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
30842    if (json.has("_origin"))
30843      parseElementProperties(getJObject(json, "_origin"), res.getOriginElement());
30844    if (json.has("params"))
30845      res.setParamsElement(parseString(json.get("params").getAsString()));
30846    if (json.has("_params"))
30847      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
30848    if (json.has("requestHeader")) {
30849      JsonArray array = json.getAsJsonArray("requestHeader");
30850      for (int i = 0; i < array.size(); i++) {
30851        res.getRequestHeader()
30852            .add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
30853      }
30854    }
30855    ;
30856    if (json.has("requestId"))
30857      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
30858    if (json.has("_requestId"))
30859      parseElementProperties(getJObject(json, "_requestId"), res.getRequestIdElement());
30860    if (json.has("responseId"))
30861      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
30862    if (json.has("_responseId"))
30863      parseElementProperties(getJObject(json, "_responseId"), res.getResponseIdElement());
30864    if (json.has("sourceId"))
30865      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
30866    if (json.has("_sourceId"))
30867      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
30868    if (json.has("targetId"))
30869      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
30870    if (json.has("_targetId"))
30871      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
30872    if (json.has("url"))
30873      res.setUrlElement(parseString(json.get("url").getAsString()));
30874    if (json.has("_url"))
30875      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
30876  }
30877
30878  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(
30879      JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
30880    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
30881    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
30882    return res;
30883  }
30884
30885  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner,
30886      TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
30887    parseBackboneElementProperties(json, res);
30888    if (json.has("field"))
30889      res.setFieldElement(parseString(json.get("field").getAsString()));
30890    if (json.has("_field"))
30891      parseElementProperties(getJObject(json, "_field"), res.getFieldElement());
30892    if (json.has("value"))
30893      res.setValueElement(parseString(json.get("value").getAsString()));
30894    if (json.has("_value"))
30895      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
30896  }
30897
30898  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json,
30899      TestScript owner) throws IOException, FHIRFormatError {
30900    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
30901    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
30902    return res;
30903  }
30904
30905  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner,
30906      TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
30907    parseBackboneElementProperties(json, res);
30908    if (json.has("label"))
30909      res.setLabelElement(parseString(json.get("label").getAsString()));
30910    if (json.has("_label"))
30911      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
30912    if (json.has("description"))
30913      res.setDescriptionElement(parseString(json.get("description").getAsString()));
30914    if (json.has("_description"))
30915      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
30916    if (json.has("direction"))
30917      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(),
30918          TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
30919    if (json.has("_direction"))
30920      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
30921    if (json.has("compareToSourceId"))
30922      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
30923    if (json.has("_compareToSourceId"))
30924      parseElementProperties(getJObject(json, "_compareToSourceId"), res.getCompareToSourceIdElement());
30925    if (json.has("compareToSourceExpression"))
30926      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
30927    if (json.has("_compareToSourceExpression"))
30928      parseElementProperties(getJObject(json, "_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
30929    if (json.has("compareToSourcePath"))
30930      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
30931    if (json.has("_compareToSourcePath"))
30932      parseElementProperties(getJObject(json, "_compareToSourcePath"), res.getCompareToSourcePathElement());
30933    if (json.has("contentType"))
30934      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
30935    if (json.has("_contentType"))
30936      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
30937    if (json.has("expression"))
30938      res.setExpressionElement(parseString(json.get("expression").getAsString()));
30939    if (json.has("_expression"))
30940      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
30941    if (json.has("headerField"))
30942      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
30943    if (json.has("_headerField"))
30944      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
30945    if (json.has("minimumId"))
30946      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
30947    if (json.has("_minimumId"))
30948      parseElementProperties(getJObject(json, "_minimumId"), res.getMinimumIdElement());
30949    if (json.has("navigationLinks"))
30950      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
30951    if (json.has("_navigationLinks"))
30952      parseElementProperties(getJObject(json, "_navigationLinks"), res.getNavigationLinksElement());
30953    if (json.has("operator"))
30954      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL,
30955          new TestScript.AssertionOperatorTypeEnumFactory()));
30956    if (json.has("_operator"))
30957      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
30958    if (json.has("path"))
30959      res.setPathElement(parseString(json.get("path").getAsString()));
30960    if (json.has("_path"))
30961      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
30962    if (json.has("requestMethod"))
30963      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(),
30964          TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
30965    if (json.has("_requestMethod"))
30966      parseElementProperties(getJObject(json, "_requestMethod"), res.getRequestMethodElement());
30967    if (json.has("requestURL"))
30968      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
30969    if (json.has("_requestURL"))
30970      parseElementProperties(getJObject(json, "_requestURL"), res.getRequestURLElement());
30971    if (json.has("resource"))
30972      res.setResourceElement(parseCode(json.get("resource").getAsString()));
30973    if (json.has("_resource"))
30974      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
30975    if (json.has("response"))
30976      res.setResponseElement(parseEnumeration(json.get("response").getAsString(),
30977          TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
30978    if (json.has("_response"))
30979      parseElementProperties(getJObject(json, "_response"), res.getResponseElement());
30980    if (json.has("responseCode"))
30981      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
30982    if (json.has("_responseCode"))
30983      parseElementProperties(getJObject(json, "_responseCode"), res.getResponseCodeElement());
30984    if (json.has("sourceId"))
30985      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
30986    if (json.has("_sourceId"))
30987      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
30988    if (json.has("validateProfileId"))
30989      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
30990    if (json.has("_validateProfileId"))
30991      parseElementProperties(getJObject(json, "_validateProfileId"), res.getValidateProfileIdElement());
30992    if (json.has("value"))
30993      res.setValueElement(parseString(json.get("value").getAsString()));
30994    if (json.has("_value"))
30995      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
30996    if (json.has("warningOnly"))
30997      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
30998    if (json.has("_warningOnly"))
30999      parseElementProperties(getJObject(json, "_warningOnly"), res.getWarningOnlyElement());
31000  }
31001
31002  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner)
31003      throws IOException, FHIRFormatError {
31004    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
31005    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
31006    return res;
31007  }
31008
31009  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner,
31010      TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
31011    parseBackboneElementProperties(json, res);
31012    if (json.has("name"))
31013      res.setNameElement(parseString(json.get("name").getAsString()));
31014    if (json.has("_name"))
31015      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
31016    if (json.has("description"))
31017      res.setDescriptionElement(parseString(json.get("description").getAsString()));
31018    if (json.has("_description"))
31019      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
31020    if (json.has("action")) {
31021      JsonArray array = json.getAsJsonArray("action");
31022      for (int i = 0; i < array.size(); i++) {
31023        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
31024      }
31025    }
31026    ;
31027  }
31028
31029  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner)
31030      throws IOException, FHIRFormatError {
31031    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
31032    parseTestScriptTestActionComponentProperties(json, owner, res);
31033    return res;
31034  }
31035
31036  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner,
31037      TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
31038    parseBackboneElementProperties(json, res);
31039    if (json.has("operation"))
31040      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
31041    if (json.has("assert"))
31042      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
31043  }
31044
31045  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json,
31046      TestScript owner) throws IOException, FHIRFormatError {
31047    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
31048    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
31049    return res;
31050  }
31051
31052  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner,
31053      TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
31054    parseBackboneElementProperties(json, res);
31055    if (json.has("action")) {
31056      JsonArray array = json.getAsJsonArray("action");
31057      for (int i = 0; i < array.size(); i++) {
31058        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
31059      }
31060    }
31061    ;
31062  }
31063
31064  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner)
31065      throws IOException, FHIRFormatError {
31066    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
31067    parseTestScriptTeardownActionComponentProperties(json, owner, res);
31068    return res;
31069  }
31070
31071  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner,
31072      TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
31073    parseBackboneElementProperties(json, res);
31074    if (json.has("operation"))
31075      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
31076  }
31077
31078  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
31079    ValueSet res = new ValueSet();
31080    parseValueSetProperties(json, res);
31081    return res;
31082  }
31083
31084  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
31085    parseDomainResourceProperties(json, res);
31086    if (json.has("url"))
31087      res.setUrlElement(parseUri(json.get("url").getAsString()));
31088    if (json.has("_url"))
31089      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
31090    if (json.has("identifier")) {
31091      JsonArray array = json.getAsJsonArray("identifier");
31092      for (int i = 0; i < array.size(); i++) {
31093        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
31094      }
31095    }
31096    ;
31097    if (json.has("version"))
31098      res.setVersionElement(parseString(json.get("version").getAsString()));
31099    if (json.has("_version"))
31100      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
31101    if (json.has("name"))
31102      res.setNameElement(parseString(json.get("name").getAsString()));
31103    if (json.has("_name"))
31104      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
31105    if (json.has("title"))
31106      res.setTitleElement(parseString(json.get("title").getAsString()));
31107    if (json.has("_title"))
31108      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
31109    if (json.has("status"))
31110      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL,
31111          new Enumerations.PublicationStatusEnumFactory()));
31112    if (json.has("_status"))
31113      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
31114    if (json.has("experimental"))
31115      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
31116    if (json.has("_experimental"))
31117      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
31118    if (json.has("date"))
31119      res.setDateElement(parseDateTime(json.get("date").getAsString()));
31120    if (json.has("_date"))
31121      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
31122    if (json.has("publisher"))
31123      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
31124    if (json.has("_publisher"))
31125      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
31126    if (json.has("contact")) {
31127      JsonArray array = json.getAsJsonArray("contact");
31128      for (int i = 0; i < array.size(); i++) {
31129        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
31130      }
31131    }
31132    ;
31133    if (json.has("description"))
31134      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
31135    if (json.has("_description"))
31136      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
31137    if (json.has("useContext")) {
31138      JsonArray array = json.getAsJsonArray("useContext");
31139      for (int i = 0; i < array.size(); i++) {
31140        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
31141      }
31142    }
31143    ;
31144    if (json.has("jurisdiction")) {
31145      JsonArray array = json.getAsJsonArray("jurisdiction");
31146      for (int i = 0; i < array.size(); i++) {
31147        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31148      }
31149    }
31150    ;
31151    if (json.has("immutable"))
31152      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
31153    if (json.has("_immutable"))
31154      parseElementProperties(getJObject(json, "_immutable"), res.getImmutableElement());
31155    if (json.has("purpose"))
31156      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
31157    if (json.has("_purpose"))
31158      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
31159    if (json.has("copyright"))
31160      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
31161    if (json.has("_copyright"))
31162      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
31163    if (json.has("compose"))
31164      res.setCompose(parseValueSetValueSetComposeComponent(getJObject(json, "compose"), res));
31165    if (json.has("expansion"))
31166      res.setExpansion(parseValueSetValueSetExpansionComponent(getJObject(json, "expansion"), res));
31167  }
31168
31169  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner)
31170      throws IOException, FHIRFormatError {
31171    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
31172    parseValueSetValueSetComposeComponentProperties(json, owner, res);
31173    return res;
31174  }
31175
31176  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner,
31177      ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
31178    parseBackboneElementProperties(json, res);
31179    if (json.has("lockedDate"))
31180      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
31181    if (json.has("_lockedDate"))
31182      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
31183    if (json.has("inactive"))
31184      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
31185    if (json.has("_inactive"))
31186      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
31187    if (json.has("include")) {
31188      JsonArray array = json.getAsJsonArray("include");
31189      for (int i = 0; i < array.size(); i++) {
31190        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
31191      }
31192    }
31193    ;
31194    if (json.has("exclude")) {
31195      JsonArray array = json.getAsJsonArray("exclude");
31196      for (int i = 0; i < array.size(); i++) {
31197        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
31198      }
31199    }
31200    ;
31201  }
31202
31203  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner)
31204      throws IOException, FHIRFormatError {
31205    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
31206    parseValueSetConceptSetComponentProperties(json, owner, res);
31207    return res;
31208  }
31209
31210  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner,
31211      ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
31212    parseBackboneElementProperties(json, res);
31213    if (json.has("system"))
31214      res.setSystemElement(parseUri(json.get("system").getAsString()));
31215    if (json.has("_system"))
31216      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
31217    if (json.has("version"))
31218      res.setVersionElement(parseString(json.get("version").getAsString()));
31219    if (json.has("_version"))
31220      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
31221    if (json.has("concept")) {
31222      JsonArray array = json.getAsJsonArray("concept");
31223      for (int i = 0; i < array.size(); i++) {
31224        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
31225      }
31226    }
31227    ;
31228    if (json.has("filter")) {
31229      JsonArray array = json.getAsJsonArray("filter");
31230      for (int i = 0; i < array.size(); i++) {
31231        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
31232      }
31233    }
31234    ;
31235    if (json.has("valueSet")) {
31236      JsonArray array = json.getAsJsonArray("valueSet");
31237      for (int i = 0; i < array.size(); i++) {
31238        if (array.get(i).isJsonNull()) {
31239          res.getValueSet().add(new CanonicalType());
31240        } else {
31241          res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
31242        }
31243      }
31244    }
31245    ;
31246    if (json.has("_valueSet")) {
31247      JsonArray array = json.getAsJsonArray("_valueSet");
31248      for (int i = 0; i < array.size(); i++) {
31249        if (i == res.getValueSet().size())
31250          res.getValueSet().add(parseCanonical(null));
31251        if (array.get(i) instanceof JsonObject)
31252          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
31253      }
31254    }
31255    ;
31256  }
31257
31258  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner)
31259      throws IOException, FHIRFormatError {
31260    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
31261    parseValueSetConceptReferenceComponentProperties(json, owner, res);
31262    return res;
31263  }
31264
31265  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner,
31266      ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
31267    parseBackboneElementProperties(json, res);
31268    if (json.has("code"))
31269      res.setCodeElement(parseCode(json.get("code").getAsString()));
31270    if (json.has("_code"))
31271      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
31272    if (json.has("display"))
31273      res.setDisplayElement(parseString(json.get("display").getAsString()));
31274    if (json.has("_display"))
31275      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
31276    if (json.has("designation")) {
31277      JsonArray array = json.getAsJsonArray("designation");
31278      for (int i = 0; i < array.size(); i++) {
31279        res.getDesignation()
31280            .add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
31281      }
31282    }
31283    ;
31284  }
31285
31286  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(
31287      JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
31288    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
31289    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
31290    return res;
31291  }
31292
31293  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner,
31294      ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
31295    parseBackboneElementProperties(json, res);
31296    if (json.has("language"))
31297      res.setLanguageElement(parseCode(json.get("language").getAsString()));
31298    if (json.has("_language"))
31299      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
31300    if (json.has("use"))
31301      res.setUse(parseCoding(getJObject(json, "use")));
31302    if (json.has("value"))
31303      res.setValueElement(parseString(json.get("value").getAsString()));
31304    if (json.has("_value"))
31305      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
31306  }
31307
31308  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner)
31309      throws IOException, FHIRFormatError {
31310    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
31311    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
31312    return res;
31313  }
31314
31315  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner,
31316      ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
31317    parseBackboneElementProperties(json, res);
31318    if (json.has("property"))
31319      res.setPropertyElement(parseCode(json.get("property").getAsString()));
31320    if (json.has("_property"))
31321      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
31322    if (json.has("op"))
31323      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL,
31324          new ValueSet.FilterOperatorEnumFactory()));
31325    if (json.has("_op"))
31326      parseElementProperties(getJObject(json, "_op"), res.getOpElement());
31327    if (json.has("value"))
31328      res.setValueElement(parseString(json.get("value").getAsString()));
31329    if (json.has("_value"))
31330      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
31331  }
31332
31333  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner)
31334      throws IOException, FHIRFormatError {
31335    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
31336    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
31337    return res;
31338  }
31339
31340  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner,
31341      ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
31342    parseBackboneElementProperties(json, res);
31343    if (json.has("identifier"))
31344      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
31345    if (json.has("_identifier"))
31346      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
31347    if (json.has("timestamp"))
31348      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
31349    if (json.has("_timestamp"))
31350      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
31351    if (json.has("total"))
31352      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
31353    if (json.has("_total"))
31354      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
31355    if (json.has("offset"))
31356      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
31357    if (json.has("_offset"))
31358      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
31359    if (json.has("parameter")) {
31360      JsonArray array = json.getAsJsonArray("parameter");
31361      for (int i = 0; i < array.size(); i++) {
31362        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
31363      }
31364    }
31365    ;
31366    if (json.has("contains")) {
31367      JsonArray array = json.getAsJsonArray("contains");
31368      for (int i = 0; i < array.size(); i++) {
31369        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
31370      }
31371    }
31372    ;
31373  }
31374
31375  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(
31376      JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
31377    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
31378    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
31379    return res;
31380  }
31381
31382  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner,
31383      ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
31384    parseBackboneElementProperties(json, res);
31385    if (json.has("name"))
31386      res.setNameElement(parseString(json.get("name").getAsString()));
31387    if (json.has("_name"))
31388      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
31389    Type value = parseType("value", json);
31390    if (value != null)
31391      res.setValue(value);
31392  }
31393
31394  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json,
31395      ValueSet owner) throws IOException, FHIRFormatError {
31396    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
31397    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
31398    return res;
31399  }
31400
31401  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner,
31402      ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
31403    parseBackboneElementProperties(json, res);
31404    if (json.has("system"))
31405      res.setSystemElement(parseUri(json.get("system").getAsString()));
31406    if (json.has("_system"))
31407      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
31408    if (json.has("abstract"))
31409      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
31410    if (json.has("_abstract"))
31411      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
31412    if (json.has("inactive"))
31413      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
31414    if (json.has("_inactive"))
31415      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
31416    if (json.has("version"))
31417      res.setVersionElement(parseString(json.get("version").getAsString()));
31418    if (json.has("_version"))
31419      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
31420    if (json.has("code"))
31421      res.setCodeElement(parseCode(json.get("code").getAsString()));
31422    if (json.has("_code"))
31423      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
31424    if (json.has("display"))
31425      res.setDisplayElement(parseString(json.get("display").getAsString()));
31426    if (json.has("_display"))
31427      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
31428    if (json.has("designation")) {
31429      JsonArray array = json.getAsJsonArray("designation");
31430      for (int i = 0; i < array.size(); i++) {
31431        res.getDesignation()
31432            .add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
31433      }
31434    }
31435    ;
31436    if (json.has("contains")) {
31437      JsonArray array = json.getAsJsonArray("contains");
31438      for (int i = 0; i < array.size(); i++) {
31439        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
31440      }
31441    }
31442    ;
31443  }
31444
31445  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
31446    VerificationResult res = new VerificationResult();
31447    parseVerificationResultProperties(json, res);
31448    return res;
31449  }
31450
31451  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res)
31452      throws IOException, FHIRFormatError {
31453    parseDomainResourceProperties(json, res);
31454    if (json.has("target")) {
31455      JsonArray array = json.getAsJsonArray("target");
31456      for (int i = 0; i < array.size(); i++) {
31457        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
31458      }
31459    }
31460    ;
31461    if (json.has("targetLocation")) {
31462      JsonArray array = json.getAsJsonArray("targetLocation");
31463      for (int i = 0; i < array.size(); i++) {
31464        if (array.get(i).isJsonNull()) {
31465          res.getTargetLocation().add(new StringType());
31466        } else {
31467          res.getTargetLocation().add(parseString(array.get(i).getAsString()));
31468        }
31469      }
31470    }
31471    ;
31472    if (json.has("_targetLocation")) {
31473      JsonArray array = json.getAsJsonArray("_targetLocation");
31474      for (int i = 0; i < array.size(); i++) {
31475        if (i == res.getTargetLocation().size())
31476          res.getTargetLocation().add(parseString(null));
31477        if (array.get(i) instanceof JsonObject)
31478          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
31479      }
31480    }
31481    ;
31482    if (json.has("need"))
31483      res.setNeed(parseCodeableConcept(getJObject(json, "need")));
31484    if (json.has("status"))
31485      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL,
31486          new VerificationResult.StatusEnumFactory()));
31487    if (json.has("_status"))
31488      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
31489    if (json.has("statusDate"))
31490      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
31491    if (json.has("_statusDate"))
31492      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
31493    if (json.has("validationType"))
31494      res.setValidationType(parseCodeableConcept(getJObject(json, "validationType")));
31495    if (json.has("validationProcess")) {
31496      JsonArray array = json.getAsJsonArray("validationProcess");
31497      for (int i = 0; i < array.size(); i++) {
31498        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31499      }
31500    }
31501    ;
31502    if (json.has("frequency"))
31503      res.setFrequency(parseTiming(getJObject(json, "frequency")));
31504    if (json.has("lastPerformed"))
31505      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
31506    if (json.has("_lastPerformed"))
31507      parseElementProperties(getJObject(json, "_lastPerformed"), res.getLastPerformedElement());
31508    if (json.has("nextScheduled"))
31509      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
31510    if (json.has("_nextScheduled"))
31511      parseElementProperties(getJObject(json, "_nextScheduled"), res.getNextScheduledElement());
31512    if (json.has("failureAction"))
31513      res.setFailureAction(parseCodeableConcept(getJObject(json, "failureAction")));
31514    if (json.has("primarySource")) {
31515      JsonArray array = json.getAsJsonArray("primarySource");
31516      for (int i = 0; i < array.size(); i++) {
31517        res.getPrimarySource()
31518            .add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
31519      }
31520    }
31521    ;
31522    if (json.has("attestation"))
31523      res.setAttestation(
31524          parseVerificationResultVerificationResultAttestationComponent(getJObject(json, "attestation"), res));
31525    if (json.has("validator")) {
31526      JsonArray array = json.getAsJsonArray("validator");
31527      for (int i = 0; i < array.size(); i++) {
31528        res.getValidator()
31529            .add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
31530      }
31531    }
31532    ;
31533  }
31534
31535  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(
31536      JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
31537    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
31538    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
31539    return res;
31540  }
31541
31542  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json,
31543      VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res)
31544      throws IOException, FHIRFormatError {
31545    parseBackboneElementProperties(json, res);
31546    if (json.has("who"))
31547      res.setWho(parseReference(getJObject(json, "who")));
31548    if (json.has("type")) {
31549      JsonArray array = json.getAsJsonArray("type");
31550      for (int i = 0; i < array.size(); i++) {
31551        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31552      }
31553    }
31554    ;
31555    if (json.has("communicationMethod")) {
31556      JsonArray array = json.getAsJsonArray("communicationMethod");
31557      for (int i = 0; i < array.size(); i++) {
31558        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31559      }
31560    }
31561    ;
31562    if (json.has("validationStatus"))
31563      res.setValidationStatus(parseCodeableConcept(getJObject(json, "validationStatus")));
31564    if (json.has("validationDate"))
31565      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
31566    if (json.has("_validationDate"))
31567      parseElementProperties(getJObject(json, "_validationDate"), res.getValidationDateElement());
31568    if (json.has("canPushUpdates"))
31569      res.setCanPushUpdates(parseCodeableConcept(getJObject(json, "canPushUpdates")));
31570    if (json.has("pushTypeAvailable")) {
31571      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
31572      for (int i = 0; i < array.size(); i++) {
31573        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
31574      }
31575    }
31576    ;
31577  }
31578
31579  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(
31580      JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
31581    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
31582    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
31583    return res;
31584  }
31585
31586  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json,
31587      VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res)
31588      throws IOException, FHIRFormatError {
31589    parseBackboneElementProperties(json, res);
31590    if (json.has("who"))
31591      res.setWho(parseReference(getJObject(json, "who")));
31592    if (json.has("onBehalfOf"))
31593      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
31594    if (json.has("communicationMethod"))
31595      res.setCommunicationMethod(parseCodeableConcept(getJObject(json, "communicationMethod")));
31596    if (json.has("date"))
31597      res.setDateElement(parseDate(json.get("date").getAsString()));
31598    if (json.has("_date"))
31599      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
31600    if (json.has("sourceIdentityCertificate"))
31601      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
31602    if (json.has("_sourceIdentityCertificate"))
31603      parseElementProperties(getJObject(json, "_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
31604    if (json.has("proxyIdentityCertificate"))
31605      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
31606    if (json.has("_proxyIdentityCertificate"))
31607      parseElementProperties(getJObject(json, "_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
31608    if (json.has("proxySignature"))
31609      res.setProxySignature(parseSignature(getJObject(json, "proxySignature")));
31610    if (json.has("sourceSignature"))
31611      res.setSourceSignature(parseSignature(getJObject(json, "sourceSignature")));
31612  }
31613
31614  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(
31615      JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
31616    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
31617    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
31618    return res;
31619  }
31620
31621  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json,
31622      VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res)
31623      throws IOException, FHIRFormatError {
31624    parseBackboneElementProperties(json, res);
31625    if (json.has("organization"))
31626      res.setOrganization(parseReference(getJObject(json, "organization")));
31627    if (json.has("identityCertificate"))
31628      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
31629    if (json.has("_identityCertificate"))
31630      parseElementProperties(getJObject(json, "_identityCertificate"), res.getIdentityCertificateElement());
31631    if (json.has("attestationSignature"))
31632      res.setAttestationSignature(parseSignature(getJObject(json, "attestationSignature")));
31633  }
31634
31635  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
31636    VisionPrescription res = new VisionPrescription();
31637    parseVisionPrescriptionProperties(json, res);
31638    return res;
31639  }
31640
31641  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res)
31642      throws IOException, FHIRFormatError {
31643    parseDomainResourceProperties(json, res);
31644    if (json.has("identifier")) {
31645      JsonArray array = json.getAsJsonArray("identifier");
31646      for (int i = 0; i < array.size(); i++) {
31647        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
31648      }
31649    }
31650    ;
31651    if (json.has("status"))
31652      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL,
31653          new VisionPrescription.VisionStatusEnumFactory()));
31654    if (json.has("_status"))
31655      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
31656    if (json.has("created"))
31657      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
31658    if (json.has("_created"))
31659      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
31660    if (json.has("patient"))
31661      res.setPatient(parseReference(getJObject(json, "patient")));
31662    if (json.has("encounter"))
31663      res.setEncounter(parseReference(getJObject(json, "encounter")));
31664    if (json.has("dateWritten"))
31665      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
31666    if (json.has("_dateWritten"))
31667      parseElementProperties(getJObject(json, "_dateWritten"), res.getDateWrittenElement());
31668    if (json.has("prescriber"))
31669      res.setPrescriber(parseReference(getJObject(json, "prescriber")));
31670    if (json.has("lensSpecification")) {
31671      JsonArray array = json.getAsJsonArray("lensSpecification");
31672      for (int i = 0; i < array.size(); i++) {
31673        res.getLensSpecification().add(
31674            parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject(), res));
31675      }
31676    }
31677    ;
31678  }
31679
31680  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(
31681      JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
31682    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
31683    parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(json, owner, res);
31684    return res;
31685  }
31686
31687  protected void parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(JsonObject json,
31688      VisionPrescription owner, VisionPrescription.VisionPrescriptionLensSpecificationComponent res)
31689      throws IOException, FHIRFormatError {
31690    parseBackboneElementProperties(json, res);
31691    if (json.has("product"))
31692      res.setProduct(parseCodeableConcept(getJObject(json, "product")));
31693    if (json.has("eye"))
31694      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL,
31695          new VisionPrescription.VisionEyesEnumFactory()));
31696    if (json.has("_eye"))
31697      parseElementProperties(getJObject(json, "_eye"), res.getEyeElement());
31698    if (json.has("sphere"))
31699      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
31700    if (json.has("_sphere"))
31701      parseElementProperties(getJObject(json, "_sphere"), res.getSphereElement());
31702    if (json.has("cylinder"))
31703      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
31704    if (json.has("_cylinder"))
31705      parseElementProperties(getJObject(json, "_cylinder"), res.getCylinderElement());
31706    if (json.has("axis"))
31707      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
31708    if (json.has("_axis"))
31709      parseElementProperties(getJObject(json, "_axis"), res.getAxisElement());
31710    if (json.has("prism")) {
31711      JsonArray array = json.getAsJsonArray("prism");
31712      for (int i = 0; i < array.size(); i++) {
31713        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
31714      }
31715    }
31716    ;
31717    if (json.has("add"))
31718      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
31719    if (json.has("_add"))
31720      parseElementProperties(getJObject(json, "_add"), res.getAddElement());
31721    if (json.has("power"))
31722      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
31723    if (json.has("_power"))
31724      parseElementProperties(getJObject(json, "_power"), res.getPowerElement());
31725    if (json.has("backCurve"))
31726      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
31727    if (json.has("_backCurve"))
31728      parseElementProperties(getJObject(json, "_backCurve"), res.getBackCurveElement());
31729    if (json.has("diameter"))
31730      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
31731    if (json.has("_diameter"))
31732      parseElementProperties(getJObject(json, "_diameter"), res.getDiameterElement());
31733    if (json.has("duration"))
31734      res.setDuration(parseQuantity(getJObject(json, "duration")));
31735    if (json.has("color"))
31736      res.setColorElement(parseString(json.get("color").getAsString()));
31737    if (json.has("_color"))
31738      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
31739    if (json.has("brand"))
31740      res.setBrandElement(parseString(json.get("brand").getAsString()));
31741    if (json.has("_brand"))
31742      parseElementProperties(getJObject(json, "_brand"), res.getBrandElement());
31743    if (json.has("note")) {
31744      JsonArray array = json.getAsJsonArray("note");
31745      for (int i = 0; i < array.size(); i++) {
31746        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
31747      }
31748    }
31749    ;
31750  }
31751
31752  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json,
31753      VisionPrescription owner) throws IOException, FHIRFormatError {
31754    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
31755    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
31756    return res;
31757  }
31758
31759  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner,
31760      VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
31761    parseBackboneElementProperties(json, res);
31762    if (json.has("amount"))
31763      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
31764    if (json.has("_amount"))
31765      parseElementProperties(getJObject(json, "_amount"), res.getAmountElement());
31766    if (json.has("base"))
31767      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL,
31768          new VisionPrescription.VisionBaseEnumFactory()));
31769    if (json.has("_base"))
31770      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
31771  }
31772
31773  @Override
31774  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
31775    if (!json.has("resourceType")) {
31776      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
31777    }
31778    String t = json.get("resourceType").getAsString();
31779    if (Utilities.noString(t))
31780      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
31781    if (t.equals("Parameters"))
31782      return parseParameters(json);
31783    else if (t.equals("Account"))
31784      return parseAccount(json);
31785    else if (t.equals("ActivityDefinition"))
31786      return parseActivityDefinition(json);
31787    else if (t.equals("AdverseEvent"))
31788      return parseAdverseEvent(json);
31789    else if (t.equals("AllergyIntolerance"))
31790      return parseAllergyIntolerance(json);
31791    else if (t.equals("Appointment"))
31792      return parseAppointment(json);
31793    else if (t.equals("AppointmentResponse"))
31794      return parseAppointmentResponse(json);
31795    else if (t.equals("AuditEvent"))
31796      return parseAuditEvent(json);
31797    else if (t.equals("Basic"))
31798      return parseBasic(json);
31799    else if (t.equals("Binary"))
31800      return parseBinary(json);
31801    else if (t.equals("BiologicallyDerivedProduct"))
31802      return parseBiologicallyDerivedProduct(json);
31803    else if (t.equals("BodyStructure"))
31804      return parseBodyStructure(json);
31805    else if (t.equals("Bundle"))
31806      return parseBundle(json);
31807    else if (t.equals("CapabilityStatement"))
31808      return parseCapabilityStatement(json);
31809    else if (t.equals("CarePlan"))
31810      return parseCarePlan(json);
31811    else if (t.equals("CareTeam"))
31812      return parseCareTeam(json);
31813    else if (t.equals("CatalogEntry"))
31814      return parseCatalogEntry(json);
31815    else if (t.equals("ChargeItem"))
31816      return parseChargeItem(json);
31817    else if (t.equals("ChargeItemDefinition"))
31818      return parseChargeItemDefinition(json);
31819    else if (t.equals("Claim"))
31820      return parseClaim(json);
31821    else if (t.equals("ClaimResponse"))
31822      return parseClaimResponse(json);
31823    else if (t.equals("ClinicalImpression"))
31824      return parseClinicalImpression(json);
31825    else if (t.equals("CodeSystem"))
31826      return parseCodeSystem(json);
31827    else if (t.equals("Communication"))
31828      return parseCommunication(json);
31829    else if (t.equals("CommunicationRequest"))
31830      return parseCommunicationRequest(json);
31831    else if (t.equals("CompartmentDefinition"))
31832      return parseCompartmentDefinition(json);
31833    else if (t.equals("Composition"))
31834      return parseComposition(json);
31835    else if (t.equals("ConceptMap"))
31836      return parseConceptMap(json);
31837    else if (t.equals("Condition"))
31838      return parseCondition(json);
31839    else if (t.equals("Consent"))
31840      return parseConsent(json);
31841    else if (t.equals("Contract"))
31842      return parseContract(json);
31843    else if (t.equals("Coverage"))
31844      return parseCoverage(json);
31845    else if (t.equals("CoverageEligibilityRequest"))
31846      return parseCoverageEligibilityRequest(json);
31847    else if (t.equals("CoverageEligibilityResponse"))
31848      return parseCoverageEligibilityResponse(json);
31849    else if (t.equals("DetectedIssue"))
31850      return parseDetectedIssue(json);
31851    else if (t.equals("Device"))
31852      return parseDevice(json);
31853    else if (t.equals("DeviceDefinition"))
31854      return parseDeviceDefinition(json);
31855    else if (t.equals("DeviceMetric"))
31856      return parseDeviceMetric(json);
31857    else if (t.equals("DeviceRequest"))
31858      return parseDeviceRequest(json);
31859    else if (t.equals("DeviceUseStatement"))
31860      return parseDeviceUseStatement(json);
31861    else if (t.equals("DiagnosticReport"))
31862      return parseDiagnosticReport(json);
31863    else if (t.equals("DocumentManifest"))
31864      return parseDocumentManifest(json);
31865    else if (t.equals("DocumentReference"))
31866      return parseDocumentReference(json);
31867    else if (t.equals("EffectEvidenceSynthesis"))
31868      return parseEffectEvidenceSynthesis(json);
31869    else if (t.equals("Encounter"))
31870      return parseEncounter(json);
31871    else if (t.equals("Endpoint"))
31872      return parseEndpoint(json);
31873    else if (t.equals("EnrollmentRequest"))
31874      return parseEnrollmentRequest(json);
31875    else if (t.equals("EnrollmentResponse"))
31876      return parseEnrollmentResponse(json);
31877    else if (t.equals("EpisodeOfCare"))
31878      return parseEpisodeOfCare(json);
31879    else if (t.equals("EventDefinition"))
31880      return parseEventDefinition(json);
31881    else if (t.equals("Evidence"))
31882      return parseEvidence(json);
31883    else if (t.equals("EvidenceVariable"))
31884      return parseEvidenceVariable(json);
31885    else if (t.equals("ExampleScenario"))
31886      return parseExampleScenario(json);
31887    else if (t.equals("ExplanationOfBenefit"))
31888      return parseExplanationOfBenefit(json);
31889    else if (t.equals("FamilyMemberHistory"))
31890      return parseFamilyMemberHistory(json);
31891    else if (t.equals("Flag"))
31892      return parseFlag(json);
31893    else if (t.equals("Goal"))
31894      return parseGoal(json);
31895    else if (t.equals("GraphDefinition"))
31896      return parseGraphDefinition(json);
31897    else if (t.equals("Group"))
31898      return parseGroup(json);
31899    else if (t.equals("GuidanceResponse"))
31900      return parseGuidanceResponse(json);
31901    else if (t.equals("HealthcareService"))
31902      return parseHealthcareService(json);
31903    else if (t.equals("ImagingStudy"))
31904      return parseImagingStudy(json);
31905    else if (t.equals("Immunization"))
31906      return parseImmunization(json);
31907    else if (t.equals("ImmunizationEvaluation"))
31908      return parseImmunizationEvaluation(json);
31909    else if (t.equals("ImmunizationRecommendation"))
31910      return parseImmunizationRecommendation(json);
31911    else if (t.equals("ImplementationGuide"))
31912      return parseImplementationGuide(json);
31913    else if (t.equals("InsurancePlan"))
31914      return parseInsurancePlan(json);
31915    else if (t.equals("Invoice"))
31916      return parseInvoice(json);
31917    else if (t.equals("Library"))
31918      return parseLibrary(json);
31919    else if (t.equals("Linkage"))
31920      return parseLinkage(json);
31921    else if (t.equals("List"))
31922      return parseListResource(json);
31923    else if (t.equals("Location"))
31924      return parseLocation(json);
31925    else if (t.equals("Measure"))
31926      return parseMeasure(json);
31927    else if (t.equals("MeasureReport"))
31928      return parseMeasureReport(json);
31929    else if (t.equals("Media"))
31930      return parseMedia(json);
31931    else if (t.equals("Medication"))
31932      return parseMedication(json);
31933    else if (t.equals("MedicationAdministration"))
31934      return parseMedicationAdministration(json);
31935    else if (t.equals("MedicationDispense"))
31936      return parseMedicationDispense(json);
31937    else if (t.equals("MedicationKnowledge"))
31938      return parseMedicationKnowledge(json);
31939    else if (t.equals("MedicationRequest"))
31940      return parseMedicationRequest(json);
31941    else if (t.equals("MedicationStatement"))
31942      return parseMedicationStatement(json);
31943    else if (t.equals("MedicinalProduct"))
31944      return parseMedicinalProduct(json);
31945    else if (t.equals("MedicinalProductAuthorization"))
31946      return parseMedicinalProductAuthorization(json);
31947    else if (t.equals("MedicinalProductContraindication"))
31948      return parseMedicinalProductContraindication(json);
31949    else if (t.equals("MedicinalProductIndication"))
31950      return parseMedicinalProductIndication(json);
31951    else if (t.equals("MedicinalProductIngredient"))
31952      return parseMedicinalProductIngredient(json);
31953    else if (t.equals("MedicinalProductInteraction"))
31954      return parseMedicinalProductInteraction(json);
31955    else if (t.equals("MedicinalProductManufactured"))
31956      return parseMedicinalProductManufactured(json);
31957    else if (t.equals("MedicinalProductPackaged"))
31958      return parseMedicinalProductPackaged(json);
31959    else if (t.equals("MedicinalProductPharmaceutical"))
31960      return parseMedicinalProductPharmaceutical(json);
31961    else if (t.equals("MedicinalProductUndesirableEffect"))
31962      return parseMedicinalProductUndesirableEffect(json);
31963    else if (t.equals("MessageDefinition"))
31964      return parseMessageDefinition(json);
31965    else if (t.equals("MessageHeader"))
31966      return parseMessageHeader(json);
31967    else if (t.equals("MolecularSequence"))
31968      return parseMolecularSequence(json);
31969    else if (t.equals("NamingSystem"))
31970      return parseNamingSystem(json);
31971    else if (t.equals("NutritionOrder"))
31972      return parseNutritionOrder(json);
31973    else if (t.equals("Observation"))
31974      return parseObservation(json);
31975    else if (t.equals("ObservationDefinition"))
31976      return parseObservationDefinition(json);
31977    else if (t.equals("OperationDefinition"))
31978      return parseOperationDefinition(json);
31979    else if (t.equals("OperationOutcome"))
31980      return parseOperationOutcome(json);
31981    else if (t.equals("Organization"))
31982      return parseOrganization(json);
31983    else if (t.equals("OrganizationAffiliation"))
31984      return parseOrganizationAffiliation(json);
31985    else if (t.equals("Patient"))
31986      return parsePatient(json);
31987    else if (t.equals("PaymentNotice"))
31988      return parsePaymentNotice(json);
31989    else if (t.equals("PaymentReconciliation"))
31990      return parsePaymentReconciliation(json);
31991    else if (t.equals("Person"))
31992      return parsePerson(json);
31993    else if (t.equals("PlanDefinition"))
31994      return parsePlanDefinition(json);
31995    else if (t.equals("Practitioner"))
31996      return parsePractitioner(json);
31997    else if (t.equals("PractitionerRole"))
31998      return parsePractitionerRole(json);
31999    else if (t.equals("Procedure"))
32000      return parseProcedure(json);
32001    else if (t.equals("Provenance"))
32002      return parseProvenance(json);
32003    else if (t.equals("Questionnaire"))
32004      return parseQuestionnaire(json);
32005    else if (t.equals("QuestionnaireResponse"))
32006      return parseQuestionnaireResponse(json);
32007    else if (t.equals("RelatedPerson"))
32008      return parseRelatedPerson(json);
32009    else if (t.equals("RequestGroup"))
32010      return parseRequestGroup(json);
32011    else if (t.equals("ResearchDefinition"))
32012      return parseResearchDefinition(json);
32013    else if (t.equals("ResearchElementDefinition"))
32014      return parseResearchElementDefinition(json);
32015    else if (t.equals("ResearchStudy"))
32016      return parseResearchStudy(json);
32017    else if (t.equals("ResearchSubject"))
32018      return parseResearchSubject(json);
32019    else if (t.equals("RiskAssessment"))
32020      return parseRiskAssessment(json);
32021    else if (t.equals("RiskEvidenceSynthesis"))
32022      return parseRiskEvidenceSynthesis(json);
32023    else if (t.equals("Schedule"))
32024      return parseSchedule(json);
32025    else if (t.equals("SearchParameter"))
32026      return parseSearchParameter(json);
32027    else if (t.equals("ServiceRequest"))
32028      return parseServiceRequest(json);
32029    else if (t.equals("Slot"))
32030      return parseSlot(json);
32031    else if (t.equals("Specimen"))
32032      return parseSpecimen(json);
32033    else if (t.equals("SpecimenDefinition"))
32034      return parseSpecimenDefinition(json);
32035    else if (t.equals("StructureDefinition"))
32036      return parseStructureDefinition(json);
32037    else if (t.equals("StructureMap"))
32038      return parseStructureMap(json);
32039    else if (t.equals("Subscription"))
32040      return parseSubscription(json);
32041    else if (t.equals("Substance"))
32042      return parseSubstance(json);
32043    else if (t.equals("SubstanceNucleicAcid"))
32044      return parseSubstanceNucleicAcid(json);
32045    else if (t.equals("SubstancePolymer"))
32046      return parseSubstancePolymer(json);
32047    else if (t.equals("SubstanceProtein"))
32048      return parseSubstanceProtein(json);
32049    else if (t.equals("SubstanceReferenceInformation"))
32050      return parseSubstanceReferenceInformation(json);
32051    else if (t.equals("SubstanceSourceMaterial"))
32052      return parseSubstanceSourceMaterial(json);
32053    else if (t.equals("SubstanceSpecification"))
32054      return parseSubstanceSpecification(json);
32055    else if (t.equals("SupplyDelivery"))
32056      return parseSupplyDelivery(json);
32057    else if (t.equals("SupplyRequest"))
32058      return parseSupplyRequest(json);
32059    else if (t.equals("Task"))
32060      return parseTask(json);
32061    else if (t.equals("TerminologyCapabilities"))
32062      return parseTerminologyCapabilities(json);
32063    else if (t.equals("TestReport"))
32064      return parseTestReport(json);
32065    else if (t.equals("TestScript"))
32066      return parseTestScript(json);
32067    else if (t.equals("ValueSet"))
32068      return parseValueSet(json);
32069    else if (t.equals("VerificationResult"))
32070      return parseVerificationResult(json);
32071    else if (t.equals("VisionPrescription"))
32072      return parseVisionPrescription(json);
32073    else if (t.equals("Binary"))
32074      return parseBinary(json);
32075    throw new FHIRFormatError("Unknown.Unrecognised resource type '" + t + "' (in property 'resourceType')");
32076  }
32077
32078  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
32079    if (json.has(prefix + "Extension"))
32080      return parseExtension(getJObject(json, prefix + "Extension"));
32081    else if (json.has(prefix + "Narrative"))
32082      return parseNarrative(getJObject(json, prefix + "Narrative"));
32083    else if (json.has(prefix + "Meta"))
32084      return parseMeta(getJObject(json, prefix + "Meta"));
32085    else if (json.has(prefix + "Address"))
32086      return parseAddress(getJObject(json, prefix + "Address"));
32087    else if (json.has(prefix + "Contributor"))
32088      return parseContributor(getJObject(json, prefix + "Contributor"));
32089    else if (json.has(prefix + "Attachment"))
32090      return parseAttachment(getJObject(json, prefix + "Attachment"));
32091    else if (json.has(prefix + "Count"))
32092      return parseCount(getJObject(json, prefix + "Count"));
32093    else if (json.has(prefix + "DataRequirement"))
32094      return parseDataRequirement(getJObject(json, prefix + "DataRequirement"));
32095    else if (json.has(prefix + "Dosage"))
32096      return parseDosage(getJObject(json, prefix + "Dosage"));
32097    else if (json.has(prefix + "Money"))
32098      return parseMoney(getJObject(json, prefix + "Money"));
32099    else if (json.has(prefix + "HumanName"))
32100      return parseHumanName(getJObject(json, prefix + "HumanName"));
32101    else if (json.has(prefix + "ContactPoint"))
32102      return parseContactPoint(getJObject(json, prefix + "ContactPoint"));
32103    else if (json.has(prefix + "MarketingStatus"))
32104      return parseMarketingStatus(getJObject(json, prefix + "MarketingStatus"));
32105    else if (json.has(prefix + "Identifier"))
32106      return parseIdentifier(getJObject(json, prefix + "Identifier"));
32107    else if (json.has(prefix + "SubstanceAmount"))
32108      return parseSubstanceAmount(getJObject(json, prefix + "SubstanceAmount"));
32109    else if (json.has(prefix + "Coding"))
32110      return parseCoding(getJObject(json, prefix + "Coding"));
32111    else if (json.has(prefix + "SampledData"))
32112      return parseSampledData(getJObject(json, prefix + "SampledData"));
32113    else if (json.has(prefix + "Population"))
32114      return parsePopulation(getJObject(json, prefix + "Population"));
32115    else if (json.has(prefix + "Ratio"))
32116      return parseRatio(getJObject(json, prefix + "Ratio"));
32117    else if (json.has(prefix + "Distance"))
32118      return parseDistance(getJObject(json, prefix + "Distance"));
32119    else if (json.has(prefix + "Age"))
32120      return parseAge(getJObject(json, prefix + "Age"));
32121    else if (json.has(prefix + "Reference"))
32122      return parseReference(getJObject(json, prefix + "Reference"));
32123    else if (json.has(prefix + "TriggerDefinition"))
32124      return parseTriggerDefinition(getJObject(json, prefix + "TriggerDefinition"));
32125    else if (json.has(prefix + "Quantity"))
32126      return parseQuantity(getJObject(json, prefix + "Quantity"));
32127    else if (json.has(prefix + "Period"))
32128      return parsePeriod(getJObject(json, prefix + "Period"));
32129    else if (json.has(prefix + "Duration"))
32130      return parseDuration(getJObject(json, prefix + "Duration"));
32131    else if (json.has(prefix + "Range"))
32132      return parseRange(getJObject(json, prefix + "Range"));
32133    else if (json.has(prefix + "RelatedArtifact"))
32134      return parseRelatedArtifact(getJObject(json, prefix + "RelatedArtifact"));
32135    else if (json.has(prefix + "Annotation"))
32136      return parseAnnotation(getJObject(json, prefix + "Annotation"));
32137    else if (json.has(prefix + "ProductShelfLife"))
32138      return parseProductShelfLife(getJObject(json, prefix + "ProductShelfLife"));
32139    else if (json.has(prefix + "ContactDetail"))
32140      return parseContactDetail(getJObject(json, prefix + "ContactDetail"));
32141    else if (json.has(prefix + "UsageContext"))
32142      return parseUsageContext(getJObject(json, prefix + "UsageContext"));
32143    else if (json.has(prefix + "Expression"))
32144      return parseExpression(getJObject(json, prefix + "Expression"));
32145    else if (json.has(prefix + "Signature"))
32146      return parseSignature(getJObject(json, prefix + "Signature"));
32147    else if (json.has(prefix + "Timing"))
32148      return parseTiming(getJObject(json, prefix + "Timing"));
32149    else if (json.has(prefix + "ProdCharacteristic"))
32150      return parseProdCharacteristic(getJObject(json, prefix + "ProdCharacteristic"));
32151    else if (json.has(prefix + "CodeableConcept"))
32152      return parseCodeableConcept(getJObject(json, prefix + "CodeableConcept"));
32153    else if (json.has(prefix + "ParameterDefinition"))
32154      return parseParameterDefinition(getJObject(json, prefix + "ParameterDefinition"));
32155    else if (json.has(prefix + "Date") || json.has("_" + prefix + "Date")) {
32156      Type t = json.has(prefix + "Date") ? parseDate(json.get(prefix + "Date").getAsString()) : new DateType();
32157      if (json.has("_" + prefix + "Date"))
32158        parseElementProperties(getJObject(json, "_" + prefix + "Date"), t);
32159      return t;
32160    } else if (json.has(prefix + "DateTime") || json.has("_" + prefix + "DateTime")) {
32161      Type t = json.has(prefix + "DateTime") ? parseDateTime(json.get(prefix + "DateTime").getAsString())
32162          : new DateTimeType();
32163      if (json.has("_" + prefix + "DateTime"))
32164        parseElementProperties(getJObject(json, "_" + prefix + "DateTime"), t);
32165      return t;
32166    } else if (json.has(prefix + "Code") || json.has("_" + prefix + "Code")) {
32167      Type t = json.has(prefix + "Code") ? parseCode(json.get(prefix + "Code").getAsString()) : new CodeType();
32168      if (json.has("_" + prefix + "Code"))
32169        parseElementProperties(getJObject(json, "_" + prefix + "Code"), t);
32170      return t;
32171    } else if (json.has(prefix + "String") || json.has("_" + prefix + "String")) {
32172      Type t = json.has(prefix + "String") ? parseString(json.get(prefix + "String").getAsString()) : new StringType();
32173      if (json.has("_" + prefix + "String"))
32174        parseElementProperties(getJObject(json, "_" + prefix + "String"), t);
32175      return t;
32176    } else if (json.has(prefix + "Integer") || json.has("_" + prefix + "Integer")) {
32177      Type t = json.has(prefix + "Integer") ? parseInteger(json.get(prefix + "Integer").getAsLong())
32178          : new IntegerType();
32179      if (json.has("_" + prefix + "Integer"))
32180        parseElementProperties(getJObject(json, "_" + prefix + "Integer"), t);
32181      return t;
32182    } else if (json.has(prefix + "Oid") || json.has("_" + prefix + "Oid")) {
32183      Type t = json.has(prefix + "Oid") ? parseOid(json.get(prefix + "Oid").getAsString()) : new OidType();
32184      if (json.has("_" + prefix + "Oid"))
32185        parseElementProperties(getJObject(json, "_" + prefix + "Oid"), t);
32186      return t;
32187    } else if (json.has(prefix + "Canonical") || json.has("_" + prefix + "Canonical")) {
32188      Type t = json.has(prefix + "Canonical") ? parseCanonical(json.get(prefix + "Canonical").getAsString())
32189          : new CanonicalType();
32190      if (json.has("_" + prefix + "Canonical"))
32191        parseElementProperties(getJObject(json, "_" + prefix + "Canonical"), t);
32192      return t;
32193    } else if (json.has(prefix + "Uri") || json.has("_" + prefix + "Uri")) {
32194      Type t = json.has(prefix + "Uri") ? parseUri(json.get(prefix + "Uri").getAsString()) : new UriType();
32195      if (json.has("_" + prefix + "Uri"))
32196        parseElementProperties(getJObject(json, "_" + prefix + "Uri"), t);
32197      return t;
32198    } else if (json.has(prefix + "Uuid") || json.has("_" + prefix + "Uuid")) {
32199      Type t = json.has(prefix + "Uuid") ? parseUuid(json.get(prefix + "Uuid").getAsString()) : new UuidType();
32200      if (json.has("_" + prefix + "Uuid"))
32201        parseElementProperties(getJObject(json, "_" + prefix + "Uuid"), t);
32202      return t;
32203    } else if (json.has(prefix + "Url") || json.has("_" + prefix + "Url")) {
32204      Type t = json.has(prefix + "Url") ? parseUrl(json.get(prefix + "Url").getAsString()) : new UrlType();
32205      if (json.has("_" + prefix + "Url"))
32206        parseElementProperties(getJObject(json, "_" + prefix + "Url"), t);
32207      return t;
32208    } else if (json.has(prefix + "Instant") || json.has("_" + prefix + "Instant")) {
32209      Type t = json.has(prefix + "Instant") ? parseInstant(json.get(prefix + "Instant").getAsString())
32210          : new InstantType();
32211      if (json.has("_" + prefix + "Instant"))
32212        parseElementProperties(getJObject(json, "_" + prefix + "Instant"), t);
32213      return t;
32214    } else if (json.has(prefix + "Boolean") || json.has("_" + prefix + "Boolean")) {
32215      Type t = json.has(prefix + "Boolean") ? parseBoolean(json.get(prefix + "Boolean").getAsBoolean())
32216          : new BooleanType();
32217      if (json.has("_" + prefix + "Boolean"))
32218        parseElementProperties(getJObject(json, "_" + prefix + "Boolean"), t);
32219      return t;
32220    } else if (json.has(prefix + "Base64Binary") || json.has("_" + prefix + "Base64Binary")) {
32221      Type t = json.has(prefix + "Base64Binary") ? parseBase64Binary(json.get(prefix + "Base64Binary").getAsString())
32222          : new Base64BinaryType();
32223      if (json.has("_" + prefix + "Base64Binary"))
32224        parseElementProperties(getJObject(json, "_" + prefix + "Base64Binary"), t);
32225      return t;
32226    } else if (json.has(prefix + "UnsignedInt") || json.has("_" + prefix + "UnsignedInt")) {
32227      Type t = json.has(prefix + "UnsignedInt") ? parseUnsignedInt(json.get(prefix + "UnsignedInt").getAsString())
32228          : new UnsignedIntType();
32229      if (json.has("_" + prefix + "UnsignedInt"))
32230        parseElementProperties(getJObject(json, "_" + prefix + "UnsignedInt"), t);
32231      return t;
32232    } else if (json.has(prefix + "Markdown") || json.has("_" + prefix + "Markdown")) {
32233      Type t = json.has(prefix + "Markdown") ? parseMarkdown(json.get(prefix + "Markdown").getAsString())
32234          : new MarkdownType();
32235      if (json.has("_" + prefix + "Markdown"))
32236        parseElementProperties(getJObject(json, "_" + prefix + "Markdown"), t);
32237      return t;
32238    } else if (json.has(prefix + "Time") || json.has("_" + prefix + "Time")) {
32239      Type t = json.has(prefix + "Time") ? parseTime(json.get(prefix + "Time").getAsString()) : new TimeType();
32240      if (json.has("_" + prefix + "Time"))
32241        parseElementProperties(getJObject(json, "_" + prefix + "Time"), t);
32242      return t;
32243    } else if (json.has(prefix + "Id") || json.has("_" + prefix + "Id")) {
32244      Type t = json.has(prefix + "Id") ? parseId(json.get(prefix + "Id").getAsString()) : new IdType();
32245      if (json.has("_" + prefix + "Id"))
32246        parseElementProperties(getJObject(json, "_" + prefix + "Id"), t);
32247      return t;
32248    } else if (json.has(prefix + "PositiveInt") || json.has("_" + prefix + "PositiveInt")) {
32249      Type t = json.has(prefix + "PositiveInt") ? parsePositiveInt(json.get(prefix + "PositiveInt").getAsString())
32250          : new PositiveIntType();
32251      if (json.has("_" + prefix + "PositiveInt"))
32252        parseElementProperties(getJObject(json, "_" + prefix + "PositiveInt"), t);
32253      return t;
32254    } else if (json.has(prefix + "Decimal") || json.has("_" + prefix + "Decimal")) {
32255      Type t = json.has(prefix + "Decimal") ? parseDecimal(json.get(prefix + "Decimal").getAsBigDecimal())
32256          : new DecimalType();
32257      if (json.has("_" + prefix + "Decimal"))
32258        parseElementProperties(getJObject(json, "_" + prefix + "Decimal"), t);
32259      return t;
32260    }
32261    return null;
32262  }
32263
32264  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
32265    if (type.equals("Extension"))
32266      return parseExtension(json);
32267    else if (type.equals("Narrative"))
32268      return parseNarrative(json);
32269    else if (type.equals("Meta"))
32270      return parseMeta(json);
32271    else if (type.equals("Address"))
32272      return parseAddress(json);
32273    else if (type.equals("Contributor"))
32274      return parseContributor(json);
32275    else if (type.equals("Attachment"))
32276      return parseAttachment(json);
32277    else if (type.equals("Count"))
32278      return parseCount(json);
32279    else if (type.equals("DataRequirement"))
32280      return parseDataRequirement(json);
32281    else if (type.equals("Dosage"))
32282      return parseDosage(json);
32283    else if (type.equals("Money"))
32284      return parseMoney(json);
32285    else if (type.equals("HumanName"))
32286      return parseHumanName(json);
32287    else if (type.equals("ContactPoint"))
32288      return parseContactPoint(json);
32289    else if (type.equals("MarketingStatus"))
32290      return parseMarketingStatus(json);
32291    else if (type.equals("Identifier"))
32292      return parseIdentifier(json);
32293    else if (type.equals("SubstanceAmount"))
32294      return parseSubstanceAmount(json);
32295    else if (type.equals("Coding"))
32296      return parseCoding(json);
32297    else if (type.equals("SampledData"))
32298      return parseSampledData(json);
32299    else if (type.equals("Population"))
32300      return parsePopulation(json);
32301    else if (type.equals("Ratio"))
32302      return parseRatio(json);
32303    else if (type.equals("Distance"))
32304      return parseDistance(json);
32305    else if (type.equals("Age"))
32306      return parseAge(json);
32307    else if (type.equals("Reference"))
32308      return parseReference(json);
32309    else if (type.equals("TriggerDefinition"))
32310      return parseTriggerDefinition(json);
32311    else if (type.equals("Quantity"))
32312      return parseQuantity(json);
32313    else if (type.equals("Period"))
32314      return parsePeriod(json);
32315    else if (type.equals("Duration"))
32316      return parseDuration(json);
32317    else if (type.equals("Range"))
32318      return parseRange(json);
32319    else if (type.equals("RelatedArtifact"))
32320      return parseRelatedArtifact(json);
32321    else if (type.equals("Annotation"))
32322      return parseAnnotation(json);
32323    else if (type.equals("ProductShelfLife"))
32324      return parseProductShelfLife(json);
32325    else if (type.equals("ContactDetail"))
32326      return parseContactDetail(json);
32327    else if (type.equals("UsageContext"))
32328      return parseUsageContext(json);
32329    else if (type.equals("Expression"))
32330      return parseExpression(json);
32331    else if (type.equals("Signature"))
32332      return parseSignature(json);
32333    else if (type.equals("Timing"))
32334      return parseTiming(json);
32335    else if (type.equals("ProdCharacteristic"))
32336      return parseProdCharacteristic(json);
32337    else if (type.equals("CodeableConcept"))
32338      return parseCodeableConcept(json);
32339    else if (type.equals("ParameterDefinition"))
32340      return parseParameterDefinition(json);
32341    throw new FHIRFormatError("Unknown Type " + type);
32342  }
32343
32344  protected boolean hasTypeName(JsonObject json, String prefix) {
32345    if (json.has(prefix + "Extension"))
32346      return true;
32347    if (json.has(prefix + "Narrative"))
32348      return true;
32349    if (json.has(prefix + "Meta"))
32350      return true;
32351    if (json.has(prefix + "Address"))
32352      return true;
32353    if (json.has(prefix + "Contributor"))
32354      return true;
32355    if (json.has(prefix + "Attachment"))
32356      return true;
32357    if (json.has(prefix + "Count"))
32358      return true;
32359    if (json.has(prefix + "DataRequirement"))
32360      return true;
32361    if (json.has(prefix + "Dosage"))
32362      return true;
32363    if (json.has(prefix + "Money"))
32364      return true;
32365    if (json.has(prefix + "HumanName"))
32366      return true;
32367    if (json.has(prefix + "ContactPoint"))
32368      return true;
32369    if (json.has(prefix + "MarketingStatus"))
32370      return true;
32371    if (json.has(prefix + "Identifier"))
32372      return true;
32373    if (json.has(prefix + "SubstanceAmount"))
32374      return true;
32375    if (json.has(prefix + "Coding"))
32376      return true;
32377    if (json.has(prefix + "SampledData"))
32378      return true;
32379    if (json.has(prefix + "Population"))
32380      return true;
32381    if (json.has(prefix + "Ratio"))
32382      return true;
32383    if (json.has(prefix + "Distance"))
32384      return true;
32385    if (json.has(prefix + "Age"))
32386      return true;
32387    if (json.has(prefix + "Reference"))
32388      return true;
32389    if (json.has(prefix + "TriggerDefinition"))
32390      return true;
32391    if (json.has(prefix + "Quantity"))
32392      return true;
32393    if (json.has(prefix + "Period"))
32394      return true;
32395    if (json.has(prefix + "Duration"))
32396      return true;
32397    if (json.has(prefix + "Range"))
32398      return true;
32399    if (json.has(prefix + "RelatedArtifact"))
32400      return true;
32401    if (json.has(prefix + "Annotation"))
32402      return true;
32403    if (json.has(prefix + "ProductShelfLife"))
32404      return true;
32405    if (json.has(prefix + "ContactDetail"))
32406      return true;
32407    if (json.has(prefix + "UsageContext"))
32408      return true;
32409    if (json.has(prefix + "Expression"))
32410      return true;
32411    if (json.has(prefix + "Signature"))
32412      return true;
32413    if (json.has(prefix + "Timing"))
32414      return true;
32415    if (json.has(prefix + "ProdCharacteristic"))
32416      return true;
32417    if (json.has(prefix + "CodeableConcept"))
32418      return true;
32419    if (json.has(prefix + "ParameterDefinition"))
32420      return true;
32421    if (json.has(prefix + "Parameters"))
32422      return true;
32423    if (json.has(prefix + "Account"))
32424      return true;
32425    if (json.has(prefix + "ActivityDefinition"))
32426      return true;
32427    if (json.has(prefix + "AdverseEvent"))
32428      return true;
32429    if (json.has(prefix + "AllergyIntolerance"))
32430      return true;
32431    if (json.has(prefix + "Appointment"))
32432      return true;
32433    if (json.has(prefix + "AppointmentResponse"))
32434      return true;
32435    if (json.has(prefix + "AuditEvent"))
32436      return true;
32437    if (json.has(prefix + "Basic"))
32438      return true;
32439    if (json.has(prefix + "Binary"))
32440      return true;
32441    if (json.has(prefix + "BiologicallyDerivedProduct"))
32442      return true;
32443    if (json.has(prefix + "BodyStructure"))
32444      return true;
32445    if (json.has(prefix + "Bundle"))
32446      return true;
32447    if (json.has(prefix + "CapabilityStatement"))
32448      return true;
32449    if (json.has(prefix + "CarePlan"))
32450      return true;
32451    if (json.has(prefix + "CareTeam"))
32452      return true;
32453    if (json.has(prefix + "CatalogEntry"))
32454      return true;
32455    if (json.has(prefix + "ChargeItem"))
32456      return true;
32457    if (json.has(prefix + "ChargeItemDefinition"))
32458      return true;
32459    if (json.has(prefix + "Claim"))
32460      return true;
32461    if (json.has(prefix + "ClaimResponse"))
32462      return true;
32463    if (json.has(prefix + "ClinicalImpression"))
32464      return true;
32465    if (json.has(prefix + "CodeSystem"))
32466      return true;
32467    if (json.has(prefix + "Communication"))
32468      return true;
32469    if (json.has(prefix + "CommunicationRequest"))
32470      return true;
32471    if (json.has(prefix + "CompartmentDefinition"))
32472      return true;
32473    if (json.has(prefix + "Composition"))
32474      return true;
32475    if (json.has(prefix + "ConceptMap"))
32476      return true;
32477    if (json.has(prefix + "Condition"))
32478      return true;
32479    if (json.has(prefix + "Consent"))
32480      return true;
32481    if (json.has(prefix + "Contract"))
32482      return true;
32483    if (json.has(prefix + "Coverage"))
32484      return true;
32485    if (json.has(prefix + "CoverageEligibilityRequest"))
32486      return true;
32487    if (json.has(prefix + "CoverageEligibilityResponse"))
32488      return true;
32489    if (json.has(prefix + "DetectedIssue"))
32490      return true;
32491    if (json.has(prefix + "Device"))
32492      return true;
32493    if (json.has(prefix + "DeviceDefinition"))
32494      return true;
32495    if (json.has(prefix + "DeviceMetric"))
32496      return true;
32497    if (json.has(prefix + "DeviceRequest"))
32498      return true;
32499    if (json.has(prefix + "DeviceUseStatement"))
32500      return true;
32501    if (json.has(prefix + "DiagnosticReport"))
32502      return true;
32503    if (json.has(prefix + "DocumentManifest"))
32504      return true;
32505    if (json.has(prefix + "DocumentReference"))
32506      return true;
32507    if (json.has(prefix + "EffectEvidenceSynthesis"))
32508      return true;
32509    if (json.has(prefix + "Encounter"))
32510      return true;
32511    if (json.has(prefix + "Endpoint"))
32512      return true;
32513    if (json.has(prefix + "EnrollmentRequest"))
32514      return true;
32515    if (json.has(prefix + "EnrollmentResponse"))
32516      return true;
32517    if (json.has(prefix + "EpisodeOfCare"))
32518      return true;
32519    if (json.has(prefix + "EventDefinition"))
32520      return true;
32521    if (json.has(prefix + "Evidence"))
32522      return true;
32523    if (json.has(prefix + "EvidenceVariable"))
32524      return true;
32525    if (json.has(prefix + "ExampleScenario"))
32526      return true;
32527    if (json.has(prefix + "ExplanationOfBenefit"))
32528      return true;
32529    if (json.has(prefix + "FamilyMemberHistory"))
32530      return true;
32531    if (json.has(prefix + "Flag"))
32532      return true;
32533    if (json.has(prefix + "Goal"))
32534      return true;
32535    if (json.has(prefix + "GraphDefinition"))
32536      return true;
32537    if (json.has(prefix + "Group"))
32538      return true;
32539    if (json.has(prefix + "GuidanceResponse"))
32540      return true;
32541    if (json.has(prefix + "HealthcareService"))
32542      return true;
32543    if (json.has(prefix + "ImagingStudy"))
32544      return true;
32545    if (json.has(prefix + "Immunization"))
32546      return true;
32547    if (json.has(prefix + "ImmunizationEvaluation"))
32548      return true;
32549    if (json.has(prefix + "ImmunizationRecommendation"))
32550      return true;
32551    if (json.has(prefix + "ImplementationGuide"))
32552      return true;
32553    if (json.has(prefix + "InsurancePlan"))
32554      return true;
32555    if (json.has(prefix + "Invoice"))
32556      return true;
32557    if (json.has(prefix + "Library"))
32558      return true;
32559    if (json.has(prefix + "Linkage"))
32560      return true;
32561    if (json.has(prefix + "List"))
32562      return true;
32563    if (json.has(prefix + "Location"))
32564      return true;
32565    if (json.has(prefix + "Measure"))
32566      return true;
32567    if (json.has(prefix + "MeasureReport"))
32568      return true;
32569    if (json.has(prefix + "Media"))
32570      return true;
32571    if (json.has(prefix + "Medication"))
32572      return true;
32573    if (json.has(prefix + "MedicationAdministration"))
32574      return true;
32575    if (json.has(prefix + "MedicationDispense"))
32576      return true;
32577    if (json.has(prefix + "MedicationKnowledge"))
32578      return true;
32579    if (json.has(prefix + "MedicationRequest"))
32580      return true;
32581    if (json.has(prefix + "MedicationStatement"))
32582      return true;
32583    if (json.has(prefix + "MedicinalProduct"))
32584      return true;
32585    if (json.has(prefix + "MedicinalProductAuthorization"))
32586      return true;
32587    if (json.has(prefix + "MedicinalProductContraindication"))
32588      return true;
32589    if (json.has(prefix + "MedicinalProductIndication"))
32590      return true;
32591    if (json.has(prefix + "MedicinalProductIngredient"))
32592      return true;
32593    if (json.has(prefix + "MedicinalProductInteraction"))
32594      return true;
32595    if (json.has(prefix + "MedicinalProductManufactured"))
32596      return true;
32597    if (json.has(prefix + "MedicinalProductPackaged"))
32598      return true;
32599    if (json.has(prefix + "MedicinalProductPharmaceutical"))
32600      return true;
32601    if (json.has(prefix + "MedicinalProductUndesirableEffect"))
32602      return true;
32603    if (json.has(prefix + "MessageDefinition"))
32604      return true;
32605    if (json.has(prefix + "MessageHeader"))
32606      return true;
32607    if (json.has(prefix + "MolecularSequence"))
32608      return true;
32609    if (json.has(prefix + "NamingSystem"))
32610      return true;
32611    if (json.has(prefix + "NutritionOrder"))
32612      return true;
32613    if (json.has(prefix + "Observation"))
32614      return true;
32615    if (json.has(prefix + "ObservationDefinition"))
32616      return true;
32617    if (json.has(prefix + "OperationDefinition"))
32618      return true;
32619    if (json.has(prefix + "OperationOutcome"))
32620      return true;
32621    if (json.has(prefix + "Organization"))
32622      return true;
32623    if (json.has(prefix + "OrganizationAffiliation"))
32624      return true;
32625    if (json.has(prefix + "Patient"))
32626      return true;
32627    if (json.has(prefix + "PaymentNotice"))
32628      return true;
32629    if (json.has(prefix + "PaymentReconciliation"))
32630      return true;
32631    if (json.has(prefix + "Person"))
32632      return true;
32633    if (json.has(prefix + "PlanDefinition"))
32634      return true;
32635    if (json.has(prefix + "Practitioner"))
32636      return true;
32637    if (json.has(prefix + "PractitionerRole"))
32638      return true;
32639    if (json.has(prefix + "Procedure"))
32640      return true;
32641    if (json.has(prefix + "Provenance"))
32642      return true;
32643    if (json.has(prefix + "Questionnaire"))
32644      return true;
32645    if (json.has(prefix + "QuestionnaireResponse"))
32646      return true;
32647    if (json.has(prefix + "RelatedPerson"))
32648      return true;
32649    if (json.has(prefix + "RequestGroup"))
32650      return true;
32651    if (json.has(prefix + "ResearchDefinition"))
32652      return true;
32653    if (json.has(prefix + "ResearchElementDefinition"))
32654      return true;
32655    if (json.has(prefix + "ResearchStudy"))
32656      return true;
32657    if (json.has(prefix + "ResearchSubject"))
32658      return true;
32659    if (json.has(prefix + "RiskAssessment"))
32660      return true;
32661    if (json.has(prefix + "RiskEvidenceSynthesis"))
32662      return true;
32663    if (json.has(prefix + "Schedule"))
32664      return true;
32665    if (json.has(prefix + "SearchParameter"))
32666      return true;
32667    if (json.has(prefix + "ServiceRequest"))
32668      return true;
32669    if (json.has(prefix + "Slot"))
32670      return true;
32671    if (json.has(prefix + "Specimen"))
32672      return true;
32673    if (json.has(prefix + "SpecimenDefinition"))
32674      return true;
32675    if (json.has(prefix + "StructureDefinition"))
32676      return true;
32677    if (json.has(prefix + "StructureMap"))
32678      return true;
32679    if (json.has(prefix + "Subscription"))
32680      return true;
32681    if (json.has(prefix + "Substance"))
32682      return true;
32683    if (json.has(prefix + "SubstanceNucleicAcid"))
32684      return true;
32685    if (json.has(prefix + "SubstancePolymer"))
32686      return true;
32687    if (json.has(prefix + "SubstanceProtein"))
32688      return true;
32689    if (json.has(prefix + "SubstanceReferenceInformation"))
32690      return true;
32691    if (json.has(prefix + "SubstanceSourceMaterial"))
32692      return true;
32693    if (json.has(prefix + "SubstanceSpecification"))
32694      return true;
32695    if (json.has(prefix + "SupplyDelivery"))
32696      return true;
32697    if (json.has(prefix + "SupplyRequest"))
32698      return true;
32699    if (json.has(prefix + "Task"))
32700      return true;
32701    if (json.has(prefix + "TerminologyCapabilities"))
32702      return true;
32703    if (json.has(prefix + "TestReport"))
32704      return true;
32705    if (json.has(prefix + "TestScript"))
32706      return true;
32707    if (json.has(prefix + "ValueSet"))
32708      return true;
32709    if (json.has(prefix + "VerificationResult"))
32710      return true;
32711    if (json.has(prefix + "VisionPrescription"))
32712      return true;
32713    if (json.has(prefix + "Date") || json.has("_" + prefix + "Date"))
32714      return true;
32715    if (json.has(prefix + "DateTime") || json.has("_" + prefix + "DateTime"))
32716      return true;
32717    if (json.has(prefix + "Code") || json.has("_" + prefix + "Code"))
32718      return true;
32719    if (json.has(prefix + "String") || json.has("_" + prefix + "String"))
32720      return true;
32721    if (json.has(prefix + "Integer") || json.has("_" + prefix + "Integer"))
32722      return true;
32723    if (json.has(prefix + "Oid") || json.has("_" + prefix + "Oid"))
32724      return true;
32725    if (json.has(prefix + "Canonical") || json.has("_" + prefix + "Canonical"))
32726      return true;
32727    if (json.has(prefix + "Uri") || json.has("_" + prefix + "Uri"))
32728      return true;
32729    if (json.has(prefix + "Uuid") || json.has("_" + prefix + "Uuid"))
32730      return true;
32731    if (json.has(prefix + "Url") || json.has("_" + prefix + "Url"))
32732      return true;
32733    if (json.has(prefix + "Instant") || json.has("_" + prefix + "Instant"))
32734      return true;
32735    if (json.has(prefix + "Boolean") || json.has("_" + prefix + "Boolean"))
32736      return true;
32737    if (json.has(prefix + "Base64Binary") || json.has("_" + prefix + "Base64Binary"))
32738      return true;
32739    if (json.has(prefix + "UnsignedInt") || json.has("_" + prefix + "UnsignedInt"))
32740      return true;
32741    if (json.has(prefix + "Markdown") || json.has("_" + prefix + "Markdown"))
32742      return true;
32743    if (json.has(prefix + "Time") || json.has("_" + prefix + "Time"))
32744      return true;
32745    if (json.has(prefix + "Id") || json.has("_" + prefix + "Id"))
32746      return true;
32747    if (json.has(prefix + "PositiveInt") || json.has("_" + prefix + "PositiveInt"))
32748      return true;
32749    if (json.has(prefix + "Decimal") || json.has("_" + prefix + "Decimal"))
32750      return true;
32751    return false;
32752  }
32753
32754  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
32755    if (type.equals("ElementDefinition"))
32756      return parseElementDefinition(json);
32757    else if (type.equals("DataRequirement"))
32758      return parseDataRequirement(json);
32759    else
32760      return parseType(json, type);
32761  }
32762
32763  protected void composeElement(Element element) throws IOException {
32764    if (element.hasId())
32765      prop("id", element.getId());
32766    if (makeComments(element)) {
32767      openArray("fhir_comments");
32768      for (String s : element.getFormatCommentsPre())
32769        prop(null, s);
32770      for (String s : element.getFormatCommentsPost())
32771        prop(null, s);
32772      closeArray();
32773    }
32774    if (element.hasExtension()) {
32775      openArray("extension");
32776      for (Extension e : element.getExtension())
32777        composeExtension(null, e);
32778      closeArray();
32779    }
32780  }
32781
32782  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
32783    composeBackbone(element);
32784  }
32785
32786  protected void composeBackbone(BackboneElement element) throws IOException {
32787    composeElement(element);
32788    if (element.hasModifierExtension()) {
32789      openArray("modifierExtension");
32790      for (Extension e : element.getModifierExtension())
32791        composeExtension(null, e);
32792      closeArray();
32793    }
32794  }
32795
32796  protected void composeBackbone(BackboneType element) throws IOException {
32797    composeElement(element);
32798    if (element.hasModifierExtension()) {
32799      openArray("modifierExtension");
32800      for (Extension e : element.getModifierExtension())
32801        composeExtension(null, e);
32802      closeArray();
32803    }
32804  }
32805
32806  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e,
32807      boolean inArray) throws IOException {
32808    if (value != null && value.getValue() != null) {
32809      prop(name, e.toCode(value.getValue()));
32810    } else if (inArray)
32811      writeNull(name);
32812  }
32813
32814  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e,
32815      boolean inArray) throws IOException {
32816    if (value != null
32817        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32818      open(inArray ? null : "_" + name);
32819      composeElement(value);
32820      close();
32821    } else if (inArray)
32822      writeNull(name);
32823  }
32824
32825  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
32826    if (value != null && value.hasValue()) {
32827      prop(name, value.asStringValue());
32828    } else if (inArray)
32829      writeNull(name);
32830  }
32831
32832  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
32833    if (value != null
32834        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32835      open(inArray ? null : "_" + name);
32836      composeElement(value);
32837      close();
32838    } else if (inArray)
32839      writeNull(name);
32840  }
32841
32842  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
32843    if (value != null && value.hasValue()) {
32844      prop(name, value.asStringValue());
32845    } else if (inArray)
32846      writeNull(name);
32847  }
32848
32849  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
32850    if (value != null
32851        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32852      open(inArray ? null : "_" + name);
32853      composeElement(value);
32854      close();
32855    } else if (inArray)
32856      writeNull(name);
32857  }
32858
32859  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
32860    if (value != null && value.hasValue()) {
32861      prop(name, toString(value.getValue()));
32862    } else if (inArray)
32863      writeNull(name);
32864  }
32865
32866  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
32867    if (value != null
32868        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32869      open(inArray ? null : "_" + name);
32870      composeElement(value);
32871      close();
32872    } else if (inArray)
32873      writeNull(name);
32874  }
32875
32876  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
32877    if (value != null && value.hasValue()) {
32878      prop(name, toString(value.getValue()));
32879    } else if (inArray)
32880      writeNull(name);
32881  }
32882
32883  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
32884    if (value != null
32885        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32886      open(inArray ? null : "_" + name);
32887      composeElement(value);
32888      close();
32889    } else if (inArray)
32890      writeNull(name);
32891  }
32892
32893  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
32894    if (value != null && value.hasValue()) {
32895      prop(name, Integer.valueOf(value.getValue()));
32896    } else if (inArray)
32897      writeNull(name);
32898  }
32899
32900  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
32901    if (value != null
32902        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32903      open(inArray ? null : "_" + name);
32904      composeElement(value);
32905      close();
32906    } else if (inArray)
32907      writeNull(name);
32908  }
32909
32910  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
32911    if (value != null && value.hasValue()) {
32912      prop(name, toString(value.getValue()));
32913    } else if (inArray)
32914      writeNull(name);
32915  }
32916
32917  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
32918    if (value != null
32919        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32920      open(inArray ? null : "_" + name);
32921      composeElement(value);
32922      close();
32923    } else if (inArray)
32924      writeNull(name);
32925  }
32926
32927  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
32928    if (value != null && value.hasValue()) {
32929      prop(name, toString(value.getValue()));
32930    } else if (inArray)
32931      writeNull(name);
32932  }
32933
32934  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
32935    if (value != null
32936        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32937      open(inArray ? null : "_" + name);
32938      composeElement(value);
32939      close();
32940    } else if (inArray)
32941      writeNull(name);
32942  }
32943
32944  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
32945    if (value != null && value.hasValue()) {
32946      prop(name, toString(value.getValue()));
32947    } else if (inArray)
32948      writeNull(name);
32949  }
32950
32951  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
32952    if (value != null
32953        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32954      open(inArray ? null : "_" + name);
32955      composeElement(value);
32956      close();
32957    } else if (inArray)
32958      writeNull(name);
32959  }
32960
32961  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
32962    if (value != null && value.hasValue()) {
32963      prop(name, toString(value.getValue()));
32964    } else if (inArray)
32965      writeNull(name);
32966  }
32967
32968  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
32969    if (value != null
32970        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32971      open(inArray ? null : "_" + name);
32972      composeElement(value);
32973      close();
32974    } else if (inArray)
32975      writeNull(name);
32976  }
32977
32978  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
32979    if (value != null && value.hasValue()) {
32980      prop(name, toString(value.getValue()));
32981    } else if (inArray)
32982      writeNull(name);
32983  }
32984
32985  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
32986    if (value != null
32987        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
32988      open(inArray ? null : "_" + name);
32989      composeElement(value);
32990      close();
32991    } else if (inArray)
32992      writeNull(name);
32993  }
32994
32995  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
32996    if (value != null && value.hasValue()) {
32997      prop(name, value.asStringValue());
32998    } else if (inArray)
32999      writeNull(name);
33000  }
33001
33002  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
33003    if (value != null
33004        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33005      open(inArray ? null : "_" + name);
33006      composeElement(value);
33007      close();
33008    } else if (inArray)
33009      writeNull(name);
33010  }
33011
33012  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
33013    if (value != null && value.hasValue()) {
33014      prop(name, value.getValue());
33015    } else if (inArray)
33016      writeNull(name);
33017  }
33018
33019  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
33020    if (value != null
33021        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33022      open(inArray ? null : "_" + name);
33023      composeElement(value);
33024      close();
33025    } else if (inArray)
33026      writeNull(name);
33027  }
33028
33029  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
33030    if (value != null && value.hasValue()) {
33031      prop(name, toString(value.getValue()));
33032    } else if (inArray)
33033      writeNull(name);
33034  }
33035
33036  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
33037    if (value != null
33038        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33039      open(inArray ? null : "_" + name);
33040      composeElement(value);
33041      close();
33042    } else if (inArray)
33043      writeNull(name);
33044  }
33045
33046  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
33047    if (value != null && value.hasValue()) {
33048      prop(name, Integer.valueOf(value.getValue()));
33049    } else if (inArray)
33050      writeNull(name);
33051  }
33052
33053  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
33054    if (value != null
33055        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33056      open(inArray ? null : "_" + name);
33057      composeElement(value);
33058      close();
33059    } else if (inArray)
33060      writeNull(name);
33061  }
33062
33063  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
33064    if (value != null && value.hasValue()) {
33065      prop(name, toString(value.getValue()));
33066    } else if (inArray)
33067      writeNull(name);
33068  }
33069
33070  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
33071    if (value != null
33072        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33073      open(inArray ? null : "_" + name);
33074      composeElement(value);
33075      close();
33076    } else if (inArray)
33077      writeNull(name);
33078  }
33079
33080  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
33081    if (value != null && value.hasValue()) {
33082      prop(name, value.asStringValue());
33083    } else if (inArray)
33084      writeNull(name);
33085  }
33086
33087  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
33088    if (value != null
33089        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33090      open(inArray ? null : "_" + name);
33091      composeElement(value);
33092      close();
33093    } else if (inArray)
33094      writeNull(name);
33095  }
33096
33097  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
33098    if (value != null && value.hasValue()) {
33099      prop(name, toString(value.getValue()));
33100    } else if (inArray)
33101      writeNull(name);
33102  }
33103
33104  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
33105    if (value != null
33106        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33107      open(inArray ? null : "_" + name);
33108      composeElement(value);
33109      close();
33110    } else if (inArray)
33111      writeNull(name);
33112  }
33113
33114  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
33115    if (value != null && value.hasValue()) {
33116      prop(name, Integer.valueOf(value.getValue()));
33117    } else if (inArray)
33118      writeNull(name);
33119  }
33120
33121  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
33122    if (value != null
33123        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33124      open(inArray ? null : "_" + name);
33125      composeElement(value);
33126      close();
33127    } else if (inArray)
33128      writeNull(name);
33129  }
33130
33131  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
33132    if (value != null && value.hasValue()) {
33133      prop(name, value.getValue());
33134    } else if (inArray)
33135      writeNull(name);
33136  }
33137
33138  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
33139    if (value != null
33140        && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
33141      open(inArray ? null : "_" + name);
33142      composeElement(value);
33143      close();
33144    } else if (inArray)
33145      writeNull(name);
33146  }
33147
33148  protected void composeExtension(String name, Extension element) throws IOException {
33149    if (element != null) {
33150      open(name);
33151      composeExtensionInner(element);
33152      close();
33153    }
33154  }
33155
33156  protected void composeExtensionInner(Extension element) throws IOException {
33157    composeElement(element);
33158    if (element.hasUrlElement()) {
33159      composeUriCore("url", element.getUrlElement(), false);
33160      composeUriExtras("url", element.getUrlElement(), false);
33161    }
33162    if (element.hasValue()) {
33163      composeType("value", element.getValue());
33164    }
33165  }
33166
33167  protected void composeNarrative(String name, Narrative element) throws IOException {
33168    if (element != null) {
33169      open(name);
33170      composeNarrativeInner(element);
33171      close();
33172    }
33173  }
33174
33175  protected void composeNarrativeInner(Narrative element) throws IOException {
33176    composeElement(element);
33177    if (element.hasStatusElement()) {
33178      composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
33179      composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
33180    }
33181    if (element.hasDiv()) {
33182      XhtmlNode node = element.getDiv();
33183      if (node.getNsDecl() == null) {
33184        node.attribute("xmlns", XHTML_NS);
33185      }
33186      composeXhtml("div", node);
33187    }
33188  }
33189
33190  protected void composeCount(String name, Count element) throws IOException {
33191    if (element != null) {
33192      open(name);
33193      composeCountInner(element);
33194      close();
33195    }
33196  }
33197
33198  protected void composeCountInner(Count element) throws IOException {
33199    composeQuantityInner(element);
33200  }
33201
33202  protected void composeDosage(String name, Dosage element) throws IOException {
33203    if (element != null) {
33204      open(name);
33205      composeDosageInner(element);
33206      close();
33207    }
33208  }
33209
33210  protected void composeDosageInner(Dosage element) throws IOException {
33211    composeBackbone(element);
33212    if (element.hasSequenceElement()) {
33213      composeIntegerCore("sequence", element.getSequenceElement(), false);
33214      composeIntegerExtras("sequence", element.getSequenceElement(), false);
33215    }
33216    if (element.hasTextElement()) {
33217      composeStringCore("text", element.getTextElement(), false);
33218      composeStringExtras("text", element.getTextElement(), false);
33219    }
33220    if (element.hasAdditionalInstruction()) {
33221      openArray("additionalInstruction");
33222      for (CodeableConcept e : element.getAdditionalInstruction())
33223        composeCodeableConcept(null, e);
33224      closeArray();
33225    }
33226    ;
33227    if (element.hasPatientInstructionElement()) {
33228      composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
33229      composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
33230    }
33231    if (element.hasTiming()) {
33232      composeTiming("timing", element.getTiming());
33233    }
33234    if (element.hasAsNeeded()) {
33235      composeType("asNeeded", element.getAsNeeded());
33236    }
33237    if (element.hasSite()) {
33238      composeCodeableConcept("site", element.getSite());
33239    }
33240    if (element.hasRoute()) {
33241      composeCodeableConcept("route", element.getRoute());
33242    }
33243    if (element.hasMethod()) {
33244      composeCodeableConcept("method", element.getMethod());
33245    }
33246    if (element.hasDoseAndRate()) {
33247      openArray("doseAndRate");
33248      for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate())
33249        composeDosageDosageDoseAndRateComponent(null, e);
33250      closeArray();
33251    }
33252    ;
33253    if (element.hasMaxDosePerPeriod()) {
33254      composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
33255    }
33256    if (element.hasMaxDosePerAdministration()) {
33257      composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
33258    }
33259    if (element.hasMaxDosePerLifetime()) {
33260      composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
33261    }
33262  }
33263
33264  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element)
33265      throws IOException {
33266    if (element != null) {
33267      open(name);
33268      composeDosageDosageDoseAndRateComponentInner(element);
33269      close();
33270    }
33271  }
33272
33273  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element)
33274      throws IOException {
33275    composeElement(element);
33276    if (element.hasType()) {
33277      composeCodeableConcept("type", element.getType());
33278    }
33279    if (element.hasDose()) {
33280      composeType("dose", element.getDose());
33281    }
33282    if (element.hasRate()) {
33283      composeType("rate", element.getRate());
33284    }
33285  }
33286
33287  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
33288    if (element != null) {
33289      open(name);
33290      composeMarketingStatusInner(element);
33291      close();
33292    }
33293  }
33294
33295  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
33296    composeBackbone(element);
33297    if (element.hasCountry()) {
33298      composeCodeableConcept("country", element.getCountry());
33299    }
33300    if (element.hasJurisdiction()) {
33301      composeCodeableConcept("jurisdiction", element.getJurisdiction());
33302    }
33303    if (element.hasStatus()) {
33304      composeCodeableConcept("status", element.getStatus());
33305    }
33306    if (element.hasDateRange()) {
33307      composePeriod("dateRange", element.getDateRange());
33308    }
33309    if (element.hasRestoreDateElement()) {
33310      composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
33311      composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
33312    }
33313  }
33314
33315  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
33316    if (element != null) {
33317      open(name);
33318      composeSubstanceAmountInner(element);
33319      close();
33320    }
33321  }
33322
33323  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
33324    composeBackbone(element);
33325    if (element.hasAmount()) {
33326      composeType("amount", element.getAmount());
33327    }
33328    if (element.hasAmountType()) {
33329      composeCodeableConcept("amountType", element.getAmountType());
33330    }
33331    if (element.hasAmountTextElement()) {
33332      composeStringCore("amountText", element.getAmountTextElement(), false);
33333      composeStringExtras("amountText", element.getAmountTextElement(), false);
33334    }
33335    if (element.hasReferenceRange()) {
33336      composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
33337    }
33338  }
33339
33340  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name,
33341      SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
33342    if (element != null) {
33343      open(name);
33344      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
33345      close();
33346    }
33347  }
33348
33349  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(
33350      SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
33351    composeElement(element);
33352    if (element.hasLowLimit()) {
33353      composeQuantity("lowLimit", element.getLowLimit());
33354    }
33355    if (element.hasHighLimit()) {
33356      composeQuantity("highLimit", element.getHighLimit());
33357    }
33358  }
33359
33360  protected void composePopulation(String name, Population element) throws IOException {
33361    if (element != null) {
33362      open(name);
33363      composePopulationInner(element);
33364      close();
33365    }
33366  }
33367
33368  protected void composePopulationInner(Population element) throws IOException {
33369    composeBackbone(element);
33370    if (element.hasAge()) {
33371      composeType("age", element.getAge());
33372    }
33373    if (element.hasGender()) {
33374      composeCodeableConcept("gender", element.getGender());
33375    }
33376    if (element.hasRace()) {
33377      composeCodeableConcept("race", element.getRace());
33378    }
33379    if (element.hasPhysiologicalCondition()) {
33380      composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
33381    }
33382  }
33383
33384  protected void composeDistance(String name, Distance element) throws IOException {
33385    if (element != null) {
33386      open(name);
33387      composeDistanceInner(element);
33388      close();
33389    }
33390  }
33391
33392  protected void composeDistanceInner(Distance element) throws IOException {
33393    composeQuantityInner(element);
33394  }
33395
33396  protected void composeAge(String name, Age element) throws IOException {
33397    if (element != null) {
33398      open(name);
33399      composeAgeInner(element);
33400      close();
33401    }
33402  }
33403
33404  protected void composeAgeInner(Age element) throws IOException {
33405    composeQuantityInner(element);
33406  }
33407
33408  protected void composeDuration(String name, Duration element) throws IOException {
33409    if (element != null) {
33410      open(name);
33411      composeDurationInner(element);
33412      close();
33413    }
33414  }
33415
33416  protected void composeDurationInner(Duration element) throws IOException {
33417    composeQuantityInner(element);
33418  }
33419
33420  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
33421    if (element != null) {
33422      open(name);
33423      composeProductShelfLifeInner(element);
33424      close();
33425    }
33426  }
33427
33428  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
33429    composeBackbone(element);
33430    if (element.hasIdentifier()) {
33431      composeIdentifier("identifier", element.getIdentifier());
33432    }
33433    if (element.hasType()) {
33434      composeCodeableConcept("type", element.getType());
33435    }
33436    if (element.hasPeriod()) {
33437      composeQuantity("period", element.getPeriod());
33438    }
33439    if (element.hasSpecialPrecautionsForStorage()) {
33440      openArray("specialPrecautionsForStorage");
33441      for (CodeableConcept e : element.getSpecialPrecautionsForStorage())
33442        composeCodeableConcept(null, e);
33443      closeArray();
33444    }
33445    ;
33446  }
33447
33448  protected void composeTiming(String name, Timing element) throws IOException {
33449    if (element != null) {
33450      open(name);
33451      composeTimingInner(element);
33452      close();
33453    }
33454  }
33455
33456  protected void composeTimingInner(Timing element) throws IOException {
33457    composeBackbone(element);
33458    if (element.hasEvent()) {
33459      openArray("event");
33460      for (DateTimeType e : element.getEvent())
33461        composeDateTimeCore(null, e, true);
33462      closeArray();
33463      if (anyHasExtras(element.getEvent())) {
33464        openArray("_event");
33465        for (DateTimeType e : element.getEvent())
33466          composeDateTimeExtras(null, e, true);
33467        closeArray();
33468      }
33469    }
33470    ;
33471    if (element.hasRepeat()) {
33472      composeTimingTimingRepeatComponent("repeat", element.getRepeat());
33473    }
33474    if (element.hasCode()) {
33475      composeCodeableConcept("code", element.getCode());
33476    }
33477  }
33478
33479  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element)
33480      throws IOException {
33481    if (element != null) {
33482      open(name);
33483      composeTimingTimingRepeatComponentInner(element);
33484      close();
33485    }
33486  }
33487
33488  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
33489    composeElement(element);
33490    if (element.hasBounds()) {
33491      composeType("bounds", element.getBounds());
33492    }
33493    if (element.hasCountElement()) {
33494      composePositiveIntCore("count", element.getCountElement(), false);
33495      composePositiveIntExtras("count", element.getCountElement(), false);
33496    }
33497    if (element.hasCountMaxElement()) {
33498      composePositiveIntCore("countMax", element.getCountMaxElement(), false);
33499      composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
33500    }
33501    if (element.hasDurationElement()) {
33502      composeDecimalCore("duration", element.getDurationElement(), false);
33503      composeDecimalExtras("duration", element.getDurationElement(), false);
33504    }
33505    if (element.hasDurationMaxElement()) {
33506      composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
33507      composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
33508    }
33509    if (element.hasDurationUnitElement()) {
33510      composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(),
33511          false);
33512      composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(),
33513          false);
33514    }
33515    if (element.hasFrequencyElement()) {
33516      composePositiveIntCore("frequency", element.getFrequencyElement(), false);
33517      composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
33518    }
33519    if (element.hasFrequencyMaxElement()) {
33520      composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
33521      composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
33522    }
33523    if (element.hasPeriodElement()) {
33524      composeDecimalCore("period", element.getPeriodElement(), false);
33525      composeDecimalExtras("period", element.getPeriodElement(), false);
33526    }
33527    if (element.hasPeriodMaxElement()) {
33528      composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
33529      composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
33530    }
33531    if (element.hasPeriodUnitElement()) {
33532      composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
33533      composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(),
33534          false);
33535    }
33536    if (element.hasDayOfWeek()) {
33537      openArray("dayOfWeek");
33538      for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek())
33539        composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
33540      closeArray();
33541      if (anyHasExtras(element.getDayOfWeek())) {
33542        openArray("_dayOfWeek");
33543        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek())
33544          composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
33545        closeArray();
33546      }
33547    }
33548    ;
33549    if (element.hasTimeOfDay()) {
33550      openArray("timeOfDay");
33551      for (TimeType e : element.getTimeOfDay())
33552        composeTimeCore(null, e, true);
33553      closeArray();
33554      if (anyHasExtras(element.getTimeOfDay())) {
33555        openArray("_timeOfDay");
33556        for (TimeType e : element.getTimeOfDay())
33557          composeTimeExtras(null, e, true);
33558        closeArray();
33559      }
33560    }
33561    ;
33562    if (element.hasWhen()) {
33563      openArray("when");
33564      for (Enumeration<Timing.EventTiming> e : element.getWhen())
33565        composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
33566      closeArray();
33567      if (anyHasExtras(element.getWhen())) {
33568        openArray("_when");
33569        for (Enumeration<Timing.EventTiming> e : element.getWhen())
33570          composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
33571        closeArray();
33572      }
33573    }
33574    ;
33575    if (element.hasOffsetElement()) {
33576      composeUnsignedIntCore("offset", element.getOffsetElement(), false);
33577      composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
33578    }
33579  }
33580
33581  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
33582    if (element != null) {
33583      open(name);
33584      composeProdCharacteristicInner(element);
33585      close();
33586    }
33587  }
33588
33589  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
33590    composeBackbone(element);
33591    if (element.hasHeight()) {
33592      composeQuantity("height", element.getHeight());
33593    }
33594    if (element.hasWidth()) {
33595      composeQuantity("width", element.getWidth());
33596    }
33597    if (element.hasDepth()) {
33598      composeQuantity("depth", element.getDepth());
33599    }
33600    if (element.hasWeight()) {
33601      composeQuantity("weight", element.getWeight());
33602    }
33603    if (element.hasNominalVolume()) {
33604      composeQuantity("nominalVolume", element.getNominalVolume());
33605    }
33606    if (element.hasExternalDiameter()) {
33607      composeQuantity("externalDiameter", element.getExternalDiameter());
33608    }
33609    if (element.hasShapeElement()) {
33610      composeStringCore("shape", element.getShapeElement(), false);
33611      composeStringExtras("shape", element.getShapeElement(), false);
33612    }
33613    if (element.hasColor()) {
33614      openArray("color");
33615      for (StringType e : element.getColor())
33616        composeStringCore(null, e, true);
33617      closeArray();
33618      if (anyHasExtras(element.getColor())) {
33619        openArray("_color");
33620        for (StringType e : element.getColor())
33621          composeStringExtras(null, e, true);
33622        closeArray();
33623      }
33624    }
33625    ;
33626    if (element.hasImprint()) {
33627      openArray("imprint");
33628      for (StringType e : element.getImprint())
33629        composeStringCore(null, e, true);
33630      closeArray();
33631      if (anyHasExtras(element.getImprint())) {
33632        openArray("_imprint");
33633        for (StringType e : element.getImprint())
33634          composeStringExtras(null, e, true);
33635        closeArray();
33636      }
33637    }
33638    ;
33639    if (element.hasImage()) {
33640      openArray("image");
33641      for (Attachment e : element.getImage())
33642        composeAttachment(null, e);
33643      closeArray();
33644    }
33645    ;
33646    if (element.hasScoring()) {
33647      composeCodeableConcept("scoring", element.getScoring());
33648    }
33649  }
33650
33651  protected void composeMeta(String name, Meta element) throws IOException {
33652    if (element != null) {
33653      open(name);
33654      composeMetaInner(element);
33655      close();
33656    }
33657  }
33658
33659  protected void composeMetaInner(Meta element) throws IOException {
33660    composeElement(element);
33661    if (element.hasVersionIdElement()) {
33662      composeIdCore("versionId", element.getVersionIdElement(), false);
33663      composeIdExtras("versionId", element.getVersionIdElement(), false);
33664    }
33665    if (element.hasLastUpdatedElement()) {
33666      composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
33667      composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
33668    }
33669    if (element.hasSourceElement()) {
33670      composeUriCore("source", element.getSourceElement(), false);
33671      composeUriExtras("source", element.getSourceElement(), false);
33672    }
33673    if (element.hasProfile()) {
33674      openArray("profile");
33675      for (CanonicalType e : element.getProfile())
33676        composeCanonicalCore(null, e, true);
33677      closeArray();
33678      if (anyHasExtras(element.getProfile())) {
33679        openArray("_profile");
33680        for (CanonicalType e : element.getProfile())
33681          composeCanonicalExtras(null, e, true);
33682        closeArray();
33683      }
33684    }
33685    ;
33686    if (element.hasSecurity()) {
33687      openArray("security");
33688      for (Coding e : element.getSecurity())
33689        composeCoding(null, e);
33690      closeArray();
33691    }
33692    ;
33693    if (element.hasTag()) {
33694      openArray("tag");
33695      for (Coding e : element.getTag())
33696        composeCoding(null, e);
33697      closeArray();
33698    }
33699    ;
33700  }
33701
33702  protected void composeAddress(String name, Address element) throws IOException {
33703    if (element != null) {
33704      open(name);
33705      composeAddressInner(element);
33706      close();
33707    }
33708  }
33709
33710  protected void composeAddressInner(Address element) throws IOException {
33711    composeElement(element);
33712    if (element.hasUseElement()) {
33713      composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
33714      composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
33715    }
33716    if (element.hasTypeElement()) {
33717      composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
33718      composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
33719    }
33720    if (element.hasTextElement()) {
33721      composeStringCore("text", element.getTextElement(), false);
33722      composeStringExtras("text", element.getTextElement(), false);
33723    }
33724    if (element.hasLine()) {
33725      openArray("line");
33726      for (StringType e : element.getLine())
33727        composeStringCore(null, e, true);
33728      closeArray();
33729      if (anyHasExtras(element.getLine())) {
33730        openArray("_line");
33731        for (StringType e : element.getLine())
33732          composeStringExtras(null, e, true);
33733        closeArray();
33734      }
33735    }
33736    ;
33737    if (element.hasCityElement()) {
33738      composeStringCore("city", element.getCityElement(), false);
33739      composeStringExtras("city", element.getCityElement(), false);
33740    }
33741    if (element.hasDistrictElement()) {
33742      composeStringCore("district", element.getDistrictElement(), false);
33743      composeStringExtras("district", element.getDistrictElement(), false);
33744    }
33745    if (element.hasStateElement()) {
33746      composeStringCore("state", element.getStateElement(), false);
33747      composeStringExtras("state", element.getStateElement(), false);
33748    }
33749    if (element.hasPostalCodeElement()) {
33750      composeStringCore("postalCode", element.getPostalCodeElement(), false);
33751      composeStringExtras("postalCode", element.getPostalCodeElement(), false);
33752    }
33753    if (element.hasCountryElement()) {
33754      composeStringCore("country", element.getCountryElement(), false);
33755      composeStringExtras("country", element.getCountryElement(), false);
33756    }
33757    if (element.hasPeriod()) {
33758      composePeriod("period", element.getPeriod());
33759    }
33760  }
33761
33762  protected void composeContributor(String name, Contributor element) throws IOException {
33763    if (element != null) {
33764      open(name);
33765      composeContributorInner(element);
33766      close();
33767    }
33768  }
33769
33770  protected void composeContributorInner(Contributor element) throws IOException {
33771    composeElement(element);
33772    if (element.hasTypeElement()) {
33773      composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
33774      composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
33775    }
33776    if (element.hasNameElement()) {
33777      composeStringCore("name", element.getNameElement(), false);
33778      composeStringExtras("name", element.getNameElement(), false);
33779    }
33780    if (element.hasContact()) {
33781      openArray("contact");
33782      for (ContactDetail e : element.getContact())
33783        composeContactDetail(null, e);
33784      closeArray();
33785    }
33786    ;
33787  }
33788
33789  protected void composeAttachment(String name, Attachment element) throws IOException {
33790    if (element != null) {
33791      open(name);
33792      composeAttachmentInner(element);
33793      close();
33794    }
33795  }
33796
33797  protected void composeAttachmentInner(Attachment element) throws IOException {
33798    composeElement(element);
33799    if (element.hasContentTypeElement()) {
33800      composeCodeCore("contentType", element.getContentTypeElement(), false);
33801      composeCodeExtras("contentType", element.getContentTypeElement(), false);
33802    }
33803    if (element.hasLanguageElement()) {
33804      composeCodeCore("language", element.getLanguageElement(), false);
33805      composeCodeExtras("language", element.getLanguageElement(), false);
33806    }
33807    if (element.hasDataElement()) {
33808      composeBase64BinaryCore("data", element.getDataElement(), false);
33809      composeBase64BinaryExtras("data", element.getDataElement(), false);
33810    }
33811    if (element.hasUrlElement()) {
33812      composeUrlCore("url", element.getUrlElement(), false);
33813      composeUrlExtras("url", element.getUrlElement(), false);
33814    }
33815    if (element.hasSizeElement()) {
33816      composeUnsignedIntCore("size", element.getSizeElement(), false);
33817      composeUnsignedIntExtras("size", element.getSizeElement(), false);
33818    }
33819    if (element.hasHashElement()) {
33820      composeBase64BinaryCore("hash", element.getHashElement(), false);
33821      composeBase64BinaryExtras("hash", element.getHashElement(), false);
33822    }
33823    if (element.hasTitleElement()) {
33824      composeStringCore("title", element.getTitleElement(), false);
33825      composeStringExtras("title", element.getTitleElement(), false);
33826    }
33827    if (element.hasCreationElement()) {
33828      composeDateTimeCore("creation", element.getCreationElement(), false);
33829      composeDateTimeExtras("creation", element.getCreationElement(), false);
33830    }
33831  }
33832
33833  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
33834    if (element != null) {
33835      open(name);
33836      composeDataRequirementInner(element);
33837      close();
33838    }
33839  }
33840
33841  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
33842    composeElement(element);
33843    if (element.hasTypeElement()) {
33844      composeCodeCore("type", element.getTypeElement(), false);
33845      composeCodeExtras("type", element.getTypeElement(), false);
33846    }
33847    if (element.hasProfile()) {
33848      openArray("profile");
33849      for (CanonicalType e : element.getProfile())
33850        composeCanonicalCore(null, e, true);
33851      closeArray();
33852      if (anyHasExtras(element.getProfile())) {
33853        openArray("_profile");
33854        for (CanonicalType e : element.getProfile())
33855          composeCanonicalExtras(null, e, true);
33856        closeArray();
33857      }
33858    }
33859    ;
33860    if (element.hasSubject()) {
33861      composeType("subject", element.getSubject());
33862    }
33863    if (element.hasMustSupport()) {
33864      openArray("mustSupport");
33865      for (StringType e : element.getMustSupport())
33866        composeStringCore(null, e, true);
33867      closeArray();
33868      if (anyHasExtras(element.getMustSupport())) {
33869        openArray("_mustSupport");
33870        for (StringType e : element.getMustSupport())
33871          composeStringExtras(null, e, true);
33872        closeArray();
33873      }
33874    }
33875    ;
33876    if (element.hasCodeFilter()) {
33877      openArray("codeFilter");
33878      for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter())
33879        composeDataRequirementDataRequirementCodeFilterComponent(null, e);
33880      closeArray();
33881    }
33882    ;
33883    if (element.hasDateFilter()) {
33884      openArray("dateFilter");
33885      for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter())
33886        composeDataRequirementDataRequirementDateFilterComponent(null, e);
33887      closeArray();
33888    }
33889    ;
33890    if (element.hasLimitElement()) {
33891      composePositiveIntCore("limit", element.getLimitElement(), false);
33892      composePositiveIntExtras("limit", element.getLimitElement(), false);
33893    }
33894    if (element.hasSort()) {
33895      openArray("sort");
33896      for (DataRequirement.DataRequirementSortComponent e : element.getSort())
33897        composeDataRequirementDataRequirementSortComponent(null, e);
33898      closeArray();
33899    }
33900    ;
33901  }
33902
33903  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name,
33904      DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
33905    if (element != null) {
33906      open(name);
33907      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
33908      close();
33909    }
33910  }
33911
33912  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(
33913      DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
33914    composeElement(element);
33915    if (element.hasPathElement()) {
33916      composeStringCore("path", element.getPathElement(), false);
33917      composeStringExtras("path", element.getPathElement(), false);
33918    }
33919    if (element.hasSearchParamElement()) {
33920      composeStringCore("searchParam", element.getSearchParamElement(), false);
33921      composeStringExtras("searchParam", element.getSearchParamElement(), false);
33922    }
33923    if (element.hasValueSetElement()) {
33924      composeCanonicalCore("valueSet", element.getValueSetElement(), false);
33925      composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
33926    }
33927    if (element.hasCode()) {
33928      openArray("code");
33929      for (Coding e : element.getCode())
33930        composeCoding(null, e);
33931      closeArray();
33932    }
33933    ;
33934  }
33935
33936  protected void composeDataRequirementDataRequirementDateFilterComponent(String name,
33937      DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
33938    if (element != null) {
33939      open(name);
33940      composeDataRequirementDataRequirementDateFilterComponentInner(element);
33941      close();
33942    }
33943  }
33944
33945  protected void composeDataRequirementDataRequirementDateFilterComponentInner(
33946      DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
33947    composeElement(element);
33948    if (element.hasPathElement()) {
33949      composeStringCore("path", element.getPathElement(), false);
33950      composeStringExtras("path", element.getPathElement(), false);
33951    }
33952    if (element.hasSearchParamElement()) {
33953      composeStringCore("searchParam", element.getSearchParamElement(), false);
33954      composeStringExtras("searchParam", element.getSearchParamElement(), false);
33955    }
33956    if (element.hasValue()) {
33957      composeType("value", element.getValue());
33958    }
33959  }
33960
33961  protected void composeDataRequirementDataRequirementSortComponent(String name,
33962      DataRequirement.DataRequirementSortComponent element) throws IOException {
33963    if (element != null) {
33964      open(name);
33965      composeDataRequirementDataRequirementSortComponentInner(element);
33966      close();
33967    }
33968  }
33969
33970  protected void composeDataRequirementDataRequirementSortComponentInner(
33971      DataRequirement.DataRequirementSortComponent element) throws IOException {
33972    composeElement(element);
33973    if (element.hasPathElement()) {
33974      composeStringCore("path", element.getPathElement(), false);
33975      composeStringExtras("path", element.getPathElement(), false);
33976    }
33977    if (element.hasDirectionElement()) {
33978      composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(),
33979          false);
33980      composeEnumerationExtras("direction", element.getDirectionElement(),
33981          new DataRequirement.SortDirectionEnumFactory(), false);
33982    }
33983  }
33984
33985  protected void composeMoney(String name, Money element) throws IOException {
33986    if (element != null) {
33987      open(name);
33988      composeMoneyInner(element);
33989      close();
33990    }
33991  }
33992
33993  protected void composeMoneyInner(Money element) throws IOException {
33994    composeElement(element);
33995    if (element.hasValueElement()) {
33996      composeDecimalCore("value", element.getValueElement(), false);
33997      composeDecimalExtras("value", element.getValueElement(), false);
33998    }
33999    if (element.hasCurrencyElement()) {
34000      composeCodeCore("currency", element.getCurrencyElement(), false);
34001      composeCodeExtras("currency", element.getCurrencyElement(), false);
34002    }
34003  }
34004
34005  protected void composeHumanName(String name, HumanName element) throws IOException {
34006    if (element != null) {
34007      open(name);
34008      composeHumanNameInner(element);
34009      close();
34010    }
34011  }
34012
34013  protected void composeHumanNameInner(HumanName element) throws IOException {
34014    composeElement(element);
34015    if (element.hasUseElement()) {
34016      composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
34017      composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
34018    }
34019    if (element.hasTextElement()) {
34020      composeStringCore("text", element.getTextElement(), false);
34021      composeStringExtras("text", element.getTextElement(), false);
34022    }
34023    if (element.hasFamilyElement()) {
34024      composeStringCore("family", element.getFamilyElement(), false);
34025      composeStringExtras("family", element.getFamilyElement(), false);
34026    }
34027    if (element.hasGiven()) {
34028      openArray("given");
34029      for (StringType e : element.getGiven())
34030        composeStringCore(null, e, true);
34031      closeArray();
34032      if (anyHasExtras(element.getGiven())) {
34033        openArray("_given");
34034        for (StringType e : element.getGiven())
34035          composeStringExtras(null, e, true);
34036        closeArray();
34037      }
34038    }
34039    ;
34040    if (element.hasPrefix()) {
34041      openArray("prefix");
34042      for (StringType e : element.getPrefix())
34043        composeStringCore(null, e, true);
34044      closeArray();
34045      if (anyHasExtras(element.getPrefix())) {
34046        openArray("_prefix");
34047        for (StringType e : element.getPrefix())
34048          composeStringExtras(null, e, true);
34049        closeArray();
34050      }
34051    }
34052    ;
34053    if (element.hasSuffix()) {
34054      openArray("suffix");
34055      for (StringType e : element.getSuffix())
34056        composeStringCore(null, e, true);
34057      closeArray();
34058      if (anyHasExtras(element.getSuffix())) {
34059        openArray("_suffix");
34060        for (StringType e : element.getSuffix())
34061          composeStringExtras(null, e, true);
34062        closeArray();
34063      }
34064    }
34065    ;
34066    if (element.hasPeriod()) {
34067      composePeriod("period", element.getPeriod());
34068    }
34069  }
34070
34071  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
34072    if (element != null) {
34073      open(name);
34074      composeContactPointInner(element);
34075      close();
34076    }
34077  }
34078
34079  protected void composeContactPointInner(ContactPoint element) throws IOException {
34080    composeElement(element);
34081    if (element.hasSystemElement()) {
34082      composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(),
34083          false);
34084      composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(),
34085          false);
34086    }
34087    if (element.hasValueElement()) {
34088      composeStringCore("value", element.getValueElement(), false);
34089      composeStringExtras("value", element.getValueElement(), false);
34090    }
34091    if (element.hasUseElement()) {
34092      composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
34093      composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
34094    }
34095    if (element.hasRankElement()) {
34096      composePositiveIntCore("rank", element.getRankElement(), false);
34097      composePositiveIntExtras("rank", element.getRankElement(), false);
34098    }
34099    if (element.hasPeriod()) {
34100      composePeriod("period", element.getPeriod());
34101    }
34102  }
34103
34104  protected void composeIdentifier(String name, Identifier element) throws IOException {
34105    if (element != null) {
34106      open(name);
34107      composeIdentifierInner(element);
34108      close();
34109    }
34110  }
34111
34112  protected void composeIdentifierInner(Identifier element) throws IOException {
34113    composeElement(element);
34114    if (element.hasUseElement()) {
34115      composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
34116      composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
34117    }
34118    if (element.hasType()) {
34119      composeCodeableConcept("type", element.getType());
34120    }
34121    if (element.hasSystemElement()) {
34122      composeUriCore("system", element.getSystemElement(), false);
34123      composeUriExtras("system", element.getSystemElement(), false);
34124    }
34125    if (element.hasValueElement()) {
34126      composeStringCore("value", element.getValueElement(), false);
34127      composeStringExtras("value", element.getValueElement(), false);
34128    }
34129    if (element.hasPeriod()) {
34130      composePeriod("period", element.getPeriod());
34131    }
34132    if (element.hasAssigner()) {
34133      composeReference("assigner", element.getAssigner());
34134    }
34135  }
34136
34137  protected void composeCoding(String name, Coding element) throws IOException {
34138    if (element != null) {
34139      open(name);
34140      composeCodingInner(element);
34141      close();
34142    }
34143  }
34144
34145  protected void composeCodingInner(Coding element) throws IOException {
34146    composeElement(element);
34147    if (element.hasSystemElement()) {
34148      composeUriCore("system", element.getSystemElement(), false);
34149      composeUriExtras("system", element.getSystemElement(), false);
34150    }
34151    if (element.hasVersionElement()) {
34152      composeStringCore("version", element.getVersionElement(), false);
34153      composeStringExtras("version", element.getVersionElement(), false);
34154    }
34155    if (element.hasCodeElement()) {
34156      composeCodeCore("code", element.getCodeElement(), false);
34157      composeCodeExtras("code", element.getCodeElement(), false);
34158    }
34159    if (element.hasDisplayElement()) {
34160      composeStringCore("display", element.getDisplayElement(), false);
34161      composeStringExtras("display", element.getDisplayElement(), false);
34162    }
34163    if (element.hasUserSelectedElement()) {
34164      composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
34165      composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
34166    }
34167  }
34168
34169  protected void composeSampledData(String name, SampledData element) throws IOException {
34170    if (element != null) {
34171      open(name);
34172      composeSampledDataInner(element);
34173      close();
34174    }
34175  }
34176
34177  protected void composeSampledDataInner(SampledData element) throws IOException {
34178    composeElement(element);
34179    if (element.hasOrigin()) {
34180      composeQuantity("origin", element.getOrigin());
34181    }
34182    if (element.hasPeriodElement()) {
34183      composeDecimalCore("period", element.getPeriodElement(), false);
34184      composeDecimalExtras("period", element.getPeriodElement(), false);
34185    }
34186    if (element.hasFactorElement()) {
34187      composeDecimalCore("factor", element.getFactorElement(), false);
34188      composeDecimalExtras("factor", element.getFactorElement(), false);
34189    }
34190    if (element.hasLowerLimitElement()) {
34191      composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
34192      composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
34193    }
34194    if (element.hasUpperLimitElement()) {
34195      composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
34196      composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
34197    }
34198    if (element.hasDimensionsElement()) {
34199      composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
34200      composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
34201    }
34202    if (element.hasDataElement()) {
34203      composeStringCore("data", element.getDataElement(), false);
34204      composeStringExtras("data", element.getDataElement(), false);
34205    }
34206  }
34207
34208  protected void composeRatio(String name, Ratio element) throws IOException {
34209    if (element != null) {
34210      open(name);
34211      composeRatioInner(element);
34212      close();
34213    }
34214  }
34215
34216  protected void composeRatioInner(Ratio element) throws IOException {
34217    composeElement(element);
34218    if (element.hasNumerator()) {
34219      composeQuantity("numerator", element.getNumerator());
34220    }
34221    if (element.hasDenominator()) {
34222      composeQuantity("denominator", element.getDenominator());
34223    }
34224  }
34225
34226  protected void composeReference(String name, Reference element) throws IOException {
34227    if (element != null) {
34228      open(name);
34229      composeReferenceInner(element);
34230      close();
34231    }
34232  }
34233
34234  protected void composeReferenceInner(Reference element) throws IOException {
34235    composeElement(element);
34236    if (element.hasReferenceElement()) {
34237      composeStringCore("reference", element.getReferenceElement(), false);
34238      composeStringExtras("reference", element.getReferenceElement(), false);
34239    }
34240    if (element.hasTypeElement()) {
34241      composeUriCore("type", element.getTypeElement(), false);
34242      composeUriExtras("type", element.getTypeElement(), false);
34243    }
34244    if (element.hasIdentifier()) {
34245      composeIdentifier("identifier", element.getIdentifier());
34246    }
34247    if (element.hasDisplayElement()) {
34248      composeStringCore("display", element.getDisplayElement(), false);
34249      composeStringExtras("display", element.getDisplayElement(), false);
34250    }
34251  }
34252
34253  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
34254    if (element != null) {
34255      open(name);
34256      composeTriggerDefinitionInner(element);
34257      close();
34258    }
34259  }
34260
34261  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
34262    composeElement(element);
34263    if (element.hasTypeElement()) {
34264      composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
34265      composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
34266    }
34267    if (element.hasNameElement()) {
34268      composeStringCore("name", element.getNameElement(), false);
34269      composeStringExtras("name", element.getNameElement(), false);
34270    }
34271    if (element.hasTiming()) {
34272      composeType("timing", element.getTiming());
34273    }
34274    if (element.hasData()) {
34275      openArray("data");
34276      for (DataRequirement e : element.getData())
34277        composeDataRequirement(null, e);
34278      closeArray();
34279    }
34280    ;
34281    if (element.hasCondition()) {
34282      composeExpression("condition", element.getCondition());
34283    }
34284  }
34285
34286  protected void composeQuantity(String name, Quantity element) throws IOException {
34287    if (element != null) {
34288      open(name);
34289      composeQuantityInner(element);
34290      close();
34291    }
34292  }
34293
34294  protected void composeQuantityInner(Quantity element) throws IOException {
34295    composeElement(element);
34296    if (element.hasValueElement()) {
34297      composeDecimalCore("value", element.getValueElement(), false);
34298      composeDecimalExtras("value", element.getValueElement(), false);
34299    }
34300    if (element.hasComparatorElement()) {
34301      composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(),
34302          false);
34303      composeEnumerationExtras("comparator", element.getComparatorElement(),
34304          new Quantity.QuantityComparatorEnumFactory(), false);
34305    }
34306    if (element.hasUnitElement()) {
34307      composeStringCore("unit", element.getUnitElement(), false);
34308      composeStringExtras("unit", element.getUnitElement(), false);
34309    }
34310    if (element.hasSystemElement()) {
34311      composeUriCore("system", element.getSystemElement(), false);
34312      composeUriExtras("system", element.getSystemElement(), false);
34313    }
34314    if (element.hasCodeElement()) {
34315      composeCodeCore("code", element.getCodeElement(), false);
34316      composeCodeExtras("code", element.getCodeElement(), false);
34317    }
34318  }
34319
34320  protected void composePeriod(String name, Period element) throws IOException {
34321    if (element != null) {
34322      open(name);
34323      composePeriodInner(element);
34324      close();
34325    }
34326  }
34327
34328  protected void composePeriodInner(Period element) throws IOException {
34329    composeElement(element);
34330    if (element.hasStartElement()) {
34331      composeDateTimeCore("start", element.getStartElement(), false);
34332      composeDateTimeExtras("start", element.getStartElement(), false);
34333    }
34334    if (element.hasEndElement()) {
34335      composeDateTimeCore("end", element.getEndElement(), false);
34336      composeDateTimeExtras("end", element.getEndElement(), false);
34337    }
34338  }
34339
34340  protected void composeRange(String name, Range element) throws IOException {
34341    if (element != null) {
34342      open(name);
34343      composeRangeInner(element);
34344      close();
34345    }
34346  }
34347
34348  protected void composeRangeInner(Range element) throws IOException {
34349    composeElement(element);
34350    if (element.hasLow()) {
34351      composeQuantity("low", element.getLow());
34352    }
34353    if (element.hasHigh()) {
34354      composeQuantity("high", element.getHigh());
34355    }
34356  }
34357
34358  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
34359    if (element != null) {
34360      open(name);
34361      composeRelatedArtifactInner(element);
34362      close();
34363    }
34364  }
34365
34366  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
34367    composeElement(element);
34368    if (element.hasTypeElement()) {
34369      composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(),
34370          false);
34371      composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(),
34372          false);
34373    }
34374    if (element.hasLabelElement()) {
34375      composeStringCore("label", element.getLabelElement(), false);
34376      composeStringExtras("label", element.getLabelElement(), false);
34377    }
34378    if (element.hasDisplayElement()) {
34379      composeStringCore("display", element.getDisplayElement(), false);
34380      composeStringExtras("display", element.getDisplayElement(), false);
34381    }
34382    if (element.hasCitationElement()) {
34383      composeMarkdownCore("citation", element.getCitationElement(), false);
34384      composeMarkdownExtras("citation", element.getCitationElement(), false);
34385    }
34386    if (element.hasUrlElement()) {
34387      composeUrlCore("url", element.getUrlElement(), false);
34388      composeUrlExtras("url", element.getUrlElement(), false);
34389    }
34390    if (element.hasDocument()) {
34391      composeAttachment("document", element.getDocument());
34392    }
34393    if (element.hasResourceElement()) {
34394      composeCanonicalCore("resource", element.getResourceElement(), false);
34395      composeCanonicalExtras("resource", element.getResourceElement(), false);
34396    }
34397  }
34398
34399  protected void composeAnnotation(String name, Annotation element) throws IOException {
34400    if (element != null) {
34401      open(name);
34402      composeAnnotationInner(element);
34403      close();
34404    }
34405  }
34406
34407  protected void composeAnnotationInner(Annotation element) throws IOException {
34408    composeElement(element);
34409    if (element.hasAuthor()) {
34410      composeType("author", element.getAuthor());
34411    }
34412    if (element.hasTimeElement()) {
34413      composeDateTimeCore("time", element.getTimeElement(), false);
34414      composeDateTimeExtras("time", element.getTimeElement(), false);
34415    }
34416    if (element.hasTextElement()) {
34417      composeMarkdownCore("text", element.getTextElement(), false);
34418      composeMarkdownExtras("text", element.getTextElement(), false);
34419    }
34420  }
34421
34422  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
34423    if (element != null) {
34424      open(name);
34425      composeContactDetailInner(element);
34426      close();
34427    }
34428  }
34429
34430  protected void composeContactDetailInner(ContactDetail element) throws IOException {
34431    composeElement(element);
34432    if (element.hasNameElement()) {
34433      composeStringCore("name", element.getNameElement(), false);
34434      composeStringExtras("name", element.getNameElement(), false);
34435    }
34436    if (element.hasTelecom()) {
34437      openArray("telecom");
34438      for (ContactPoint e : element.getTelecom())
34439        composeContactPoint(null, e);
34440      closeArray();
34441    }
34442    ;
34443  }
34444
34445  protected void composeUsageContext(String name, UsageContext element) throws IOException {
34446    if (element != null) {
34447      open(name);
34448      composeUsageContextInner(element);
34449      close();
34450    }
34451  }
34452
34453  protected void composeUsageContextInner(UsageContext element) throws IOException {
34454    composeElement(element);
34455    if (element.hasCode()) {
34456      composeCoding("code", element.getCode());
34457    }
34458    if (element.hasValue()) {
34459      composeType("value", element.getValue());
34460    }
34461  }
34462
34463  protected void composeExpression(String name, Expression element) throws IOException {
34464    if (element != null) {
34465      open(name);
34466      composeExpressionInner(element);
34467      close();
34468    }
34469  }
34470
34471  protected void composeExpressionInner(Expression element) throws IOException {
34472    composeElement(element);
34473    if (element.hasDescriptionElement()) {
34474      composeStringCore("description", element.getDescriptionElement(), false);
34475      composeStringExtras("description", element.getDescriptionElement(), false);
34476    }
34477    if (element.hasNameElement()) {
34478      composeIdCore("name", element.getNameElement(), false);
34479      composeIdExtras("name", element.getNameElement(), false);
34480    }
34481    if (element.hasLanguageElement()) {
34482      composeCodeCore("language", element.getLanguageElement(), false);
34483      composeCodeExtras("language", element.getLanguageElement(), false);
34484    }
34485    if (element.hasExpressionElement()) {
34486      composeStringCore("expression", element.getExpressionElement(), false);
34487      composeStringExtras("expression", element.getExpressionElement(), false);
34488    }
34489    if (element.hasReferenceElement()) {
34490      composeUriCore("reference", element.getReferenceElement(), false);
34491      composeUriExtras("reference", element.getReferenceElement(), false);
34492    }
34493  }
34494
34495  protected void composeSignature(String name, Signature element) throws IOException {
34496    if (element != null) {
34497      open(name);
34498      composeSignatureInner(element);
34499      close();
34500    }
34501  }
34502
34503  protected void composeSignatureInner(Signature element) throws IOException {
34504    composeElement(element);
34505    if (element.hasType()) {
34506      openArray("type");
34507      for (Coding e : element.getType())
34508        composeCoding(null, e);
34509      closeArray();
34510    }
34511    ;
34512    if (element.hasWhenElement()) {
34513      composeInstantCore("when", element.getWhenElement(), false);
34514      composeInstantExtras("when", element.getWhenElement(), false);
34515    }
34516    if (element.hasWho()) {
34517      composeReference("who", element.getWho());
34518    }
34519    if (element.hasOnBehalfOf()) {
34520      composeReference("onBehalfOf", element.getOnBehalfOf());
34521    }
34522    if (element.hasTargetFormatElement()) {
34523      composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
34524      composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
34525    }
34526    if (element.hasSigFormatElement()) {
34527      composeCodeCore("sigFormat", element.getSigFormatElement(), false);
34528      composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
34529    }
34530    if (element.hasDataElement()) {
34531      composeBase64BinaryCore("data", element.getDataElement(), false);
34532      composeBase64BinaryExtras("data", element.getDataElement(), false);
34533    }
34534  }
34535
34536  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
34537    if (element != null) {
34538      open(name);
34539      composeCodeableConceptInner(element);
34540      close();
34541    }
34542  }
34543
34544  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
34545    composeElement(element);
34546    if (element.hasCoding()) {
34547      openArray("coding");
34548      for (Coding e : element.getCoding())
34549        composeCoding(null, e);
34550      closeArray();
34551    }
34552    ;
34553    if (element.hasTextElement()) {
34554      composeStringCore("text", element.getTextElement(), false);
34555      composeStringExtras("text", element.getTextElement(), false);
34556    }
34557  }
34558
34559  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
34560    if (element != null) {
34561      open(name);
34562      composeParameterDefinitionInner(element);
34563      close();
34564    }
34565  }
34566
34567  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
34568    composeElement(element);
34569    if (element.hasNameElement()) {
34570      composeCodeCore("name", element.getNameElement(), false);
34571      composeCodeExtras("name", element.getNameElement(), false);
34572    }
34573    if (element.hasUseElement()) {
34574      composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
34575      composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(),
34576          false);
34577    }
34578    if (element.hasMinElement()) {
34579      composeIntegerCore("min", element.getMinElement(), false);
34580      composeIntegerExtras("min", element.getMinElement(), false);
34581    }
34582    if (element.hasMaxElement()) {
34583      composeStringCore("max", element.getMaxElement(), false);
34584      composeStringExtras("max", element.getMaxElement(), false);
34585    }
34586    if (element.hasDocumentationElement()) {
34587      composeStringCore("documentation", element.getDocumentationElement(), false);
34588      composeStringExtras("documentation", element.getDocumentationElement(), false);
34589    }
34590    if (element.hasTypeElement()) {
34591      composeCodeCore("type", element.getTypeElement(), false);
34592      composeCodeExtras("type", element.getTypeElement(), false);
34593    }
34594    if (element.hasProfileElement()) {
34595      composeCanonicalCore("profile", element.getProfileElement(), false);
34596      composeCanonicalExtras("profile", element.getProfileElement(), false);
34597    }
34598  }
34599
34600  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
34601    if (element != null) {
34602      open(name);
34603      composeElementDefinitionInner(element);
34604      close();
34605    }
34606  }
34607
34608  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
34609    composeBackbone(element);
34610    if (element.hasPathElement()) {
34611      composeStringCore("path", element.getPathElement(), false);
34612      composeStringExtras("path", element.getPathElement(), false);
34613    }
34614    if (element.hasRepresentation()) {
34615      openArray("representation");
34616      for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation())
34617        composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
34618      closeArray();
34619      if (anyHasExtras(element.getRepresentation())) {
34620        openArray("_representation");
34621        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation())
34622          composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
34623        closeArray();
34624      }
34625    }
34626    ;
34627    if (element.hasSliceNameElement()) {
34628      composeStringCore("sliceName", element.getSliceNameElement(), false);
34629      composeStringExtras("sliceName", element.getSliceNameElement(), false);
34630    }
34631    if (element.hasSliceIsConstrainingElement()) {
34632      composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
34633      composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
34634    }
34635    if (element.hasLabelElement()) {
34636      composeStringCore("label", element.getLabelElement(), false);
34637      composeStringExtras("label", element.getLabelElement(), false);
34638    }
34639    if (element.hasCode()) {
34640      openArray("code");
34641      for (Coding e : element.getCode())
34642        composeCoding(null, e);
34643      closeArray();
34644    }
34645    ;
34646    if (element.hasSlicing()) {
34647      composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
34648    }
34649    if (element.hasShortElement()) {
34650      composeStringCore("short", element.getShortElement(), false);
34651      composeStringExtras("short", element.getShortElement(), false);
34652    }
34653    if (element.hasDefinitionElement()) {
34654      composeMarkdownCore("definition", element.getDefinitionElement(), false);
34655      composeMarkdownExtras("definition", element.getDefinitionElement(), false);
34656    }
34657    if (element.hasCommentElement()) {
34658      composeMarkdownCore("comment", element.getCommentElement(), false);
34659      composeMarkdownExtras("comment", element.getCommentElement(), false);
34660    }
34661    if (element.hasRequirementsElement()) {
34662      composeMarkdownCore("requirements", element.getRequirementsElement(), false);
34663      composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
34664    }
34665    if (element.hasAlias()) {
34666      openArray("alias");
34667      for (StringType e : element.getAlias())
34668        composeStringCore(null, e, true);
34669      closeArray();
34670      if (anyHasExtras(element.getAlias())) {
34671        openArray("_alias");
34672        for (StringType e : element.getAlias())
34673          composeStringExtras(null, e, true);
34674        closeArray();
34675      }
34676    }
34677    ;
34678    if (element.hasMinElement()) {
34679      composeUnsignedIntCore("min", element.getMinElement(), false);
34680      composeUnsignedIntExtras("min", element.getMinElement(), false);
34681    }
34682    if (element.hasMaxElement()) {
34683      composeStringCore("max", element.getMaxElement(), false);
34684      composeStringExtras("max", element.getMaxElement(), false);
34685    }
34686    if (element.hasBase()) {
34687      composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
34688    }
34689    if (element.hasContentReferenceElement()) {
34690      composeUriCore("contentReference", element.getContentReferenceElement(), false);
34691      composeUriExtras("contentReference", element.getContentReferenceElement(), false);
34692    }
34693    if (element.hasType()) {
34694      openArray("type");
34695      for (ElementDefinition.TypeRefComponent e : element.getType())
34696        composeElementDefinitionTypeRefComponent(null, e);
34697      closeArray();
34698    }
34699    ;
34700    if (element.hasDefaultValue()) {
34701      composeType("defaultValue", element.getDefaultValue());
34702    }
34703    if (element.hasMeaningWhenMissingElement()) {
34704      composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
34705      composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
34706    }
34707    if (element.hasOrderMeaningElement()) {
34708      composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
34709      composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
34710    }
34711    if (element.hasFixed()) {
34712      composeType("fixed", element.getFixed());
34713    }
34714    if (element.hasPattern()) {
34715      composeType("pattern", element.getPattern());
34716    }
34717    if (element.hasExample()) {
34718      openArray("example");
34719      for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample())
34720        composeElementDefinitionElementDefinitionExampleComponent(null, e);
34721      closeArray();
34722    }
34723    ;
34724    if (element.hasMinValue()) {
34725      composeType("minValue", element.getMinValue());
34726    }
34727    if (element.hasMaxValue()) {
34728      composeType("maxValue", element.getMaxValue());
34729    }
34730    if (element.hasMaxLengthElement()) {
34731      composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
34732      composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
34733    }
34734    if (element.hasCondition()) {
34735      openArray("condition");
34736      for (IdType e : element.getCondition())
34737        composeIdCore(null, e, true);
34738      closeArray();
34739      if (anyHasExtras(element.getCondition())) {
34740        openArray("_condition");
34741        for (IdType e : element.getCondition())
34742          composeIdExtras(null, e, true);
34743        closeArray();
34744      }
34745    }
34746    ;
34747    if (element.hasConstraint()) {
34748      openArray("constraint");
34749      for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint())
34750        composeElementDefinitionElementDefinitionConstraintComponent(null, e);
34751      closeArray();
34752    }
34753    ;
34754    if (element.hasMustSupportElement()) {
34755      composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
34756      composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
34757    }
34758    if (element.hasIsModifierElement()) {
34759      composeBooleanCore("isModifier", element.getIsModifierElement(), false);
34760      composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
34761    }
34762    if (element.hasIsModifierReasonElement()) {
34763      composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
34764      composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
34765    }
34766    if (element.hasIsSummaryElement()) {
34767      composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
34768      composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
34769    }
34770    if (element.hasBinding()) {
34771      composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
34772    }
34773    if (element.hasMapping()) {
34774      openArray("mapping");
34775      for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping())
34776        composeElementDefinitionElementDefinitionMappingComponent(null, e);
34777      closeArray();
34778    }
34779    ;
34780  }
34781
34782  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name,
34783      ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
34784    if (element != null) {
34785      open(name);
34786      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
34787      close();
34788    }
34789  }
34790
34791  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(
34792      ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
34793    composeElement(element);
34794    if (element.hasDiscriminator()) {
34795      openArray("discriminator");
34796      for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator())
34797        composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
34798      closeArray();
34799    }
34800    ;
34801    if (element.hasDescriptionElement()) {
34802      composeStringCore("description", element.getDescriptionElement(), false);
34803      composeStringExtras("description", element.getDescriptionElement(), false);
34804    }
34805    if (element.hasOrderedElement()) {
34806      composeBooleanCore("ordered", element.getOrderedElement(), false);
34807      composeBooleanExtras("ordered", element.getOrderedElement(), false);
34808    }
34809    if (element.hasRulesElement()) {
34810      composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(),
34811          false);
34812      composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(),
34813          false);
34814    }
34815  }
34816
34817  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name,
34818      ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
34819    if (element != null) {
34820      open(name);
34821      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
34822      close();
34823    }
34824  }
34825
34826  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(
34827      ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
34828    composeElement(element);
34829    if (element.hasTypeElement()) {
34830      composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(),
34831          false);
34832      composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(),
34833          false);
34834    }
34835    if (element.hasPathElement()) {
34836      composeStringCore("path", element.getPathElement(), false);
34837      composeStringExtras("path", element.getPathElement(), false);
34838    }
34839  }
34840
34841  protected void composeElementDefinitionElementDefinitionBaseComponent(String name,
34842      ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
34843    if (element != null) {
34844      open(name);
34845      composeElementDefinitionElementDefinitionBaseComponentInner(element);
34846      close();
34847    }
34848  }
34849
34850  protected void composeElementDefinitionElementDefinitionBaseComponentInner(
34851      ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
34852    composeElement(element);
34853    if (element.hasPathElement()) {
34854      composeStringCore("path", element.getPathElement(), false);
34855      composeStringExtras("path", element.getPathElement(), false);
34856    }
34857    if (element.hasMinElement()) {
34858      composeUnsignedIntCore("min", element.getMinElement(), false);
34859      composeUnsignedIntExtras("min", element.getMinElement(), false);
34860    }
34861    if (element.hasMaxElement()) {
34862      composeStringCore("max", element.getMaxElement(), false);
34863      composeStringExtras("max", element.getMaxElement(), false);
34864    }
34865  }
34866
34867  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element)
34868      throws IOException {
34869    if (element != null) {
34870      open(name);
34871      composeElementDefinitionTypeRefComponentInner(element);
34872      close();
34873    }
34874  }
34875
34876  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element)
34877      throws IOException {
34878    composeElement(element);
34879    if (element.hasCodeElement()) {
34880      composeUriCore("code", element.getCodeElement(), false);
34881      composeUriExtras("code", element.getCodeElement(), false);
34882    }
34883    if (element.hasProfile()) {
34884      openArray("profile");
34885      for (CanonicalType e : element.getProfile())
34886        composeCanonicalCore(null, e, true);
34887      closeArray();
34888      if (anyHasExtras(element.getProfile())) {
34889        openArray("_profile");
34890        for (CanonicalType e : element.getProfile())
34891          composeCanonicalExtras(null, e, true);
34892        closeArray();
34893      }
34894    }
34895    ;
34896    if (element.hasTargetProfile()) {
34897      openArray("targetProfile");
34898      for (CanonicalType e : element.getTargetProfile())
34899        composeCanonicalCore(null, e, true);
34900      closeArray();
34901      if (anyHasExtras(element.getTargetProfile())) {
34902        openArray("_targetProfile");
34903        for (CanonicalType e : element.getTargetProfile())
34904          composeCanonicalExtras(null, e, true);
34905        closeArray();
34906      }
34907    }
34908    ;
34909    if (element.hasAggregation()) {
34910      openArray("aggregation");
34911      for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation())
34912        composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
34913      closeArray();
34914      if (anyHasExtras(element.getAggregation())) {
34915        openArray("_aggregation");
34916        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation())
34917          composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
34918        closeArray();
34919      }
34920    }
34921    ;
34922    if (element.hasVersioningElement()) {
34923      composeEnumerationCore("versioning", element.getVersioningElement(),
34924          new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
34925      composeEnumerationExtras("versioning", element.getVersioningElement(),
34926          new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
34927    }
34928  }
34929
34930  protected void composeElementDefinitionElementDefinitionExampleComponent(String name,
34931      ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
34932    if (element != null) {
34933      open(name);
34934      composeElementDefinitionElementDefinitionExampleComponentInner(element);
34935      close();
34936    }
34937  }
34938
34939  protected void composeElementDefinitionElementDefinitionExampleComponentInner(
34940      ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
34941    composeElement(element);
34942    if (element.hasLabelElement()) {
34943      composeStringCore("label", element.getLabelElement(), false);
34944      composeStringExtras("label", element.getLabelElement(), false);
34945    }
34946    if (element.hasValue()) {
34947      composeType("value", element.getValue());
34948    }
34949  }
34950
34951  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name,
34952      ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
34953    if (element != null) {
34954      open(name);
34955      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
34956      close();
34957    }
34958  }
34959
34960  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(
34961      ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
34962    composeElement(element);
34963    if (element.hasKeyElement()) {
34964      composeIdCore("key", element.getKeyElement(), false);
34965      composeIdExtras("key", element.getKeyElement(), false);
34966    }
34967    if (element.hasRequirementsElement()) {
34968      composeStringCore("requirements", element.getRequirementsElement(), false);
34969      composeStringExtras("requirements", element.getRequirementsElement(), false);
34970    }
34971    if (element.hasSeverityElement()) {
34972      composeEnumerationCore("severity", element.getSeverityElement(),
34973          new ElementDefinition.ConstraintSeverityEnumFactory(), false);
34974      composeEnumerationExtras("severity", element.getSeverityElement(),
34975          new ElementDefinition.ConstraintSeverityEnumFactory(), false);
34976    }
34977    if (element.hasHumanElement()) {
34978      composeStringCore("human", element.getHumanElement(), false);
34979      composeStringExtras("human", element.getHumanElement(), false);
34980    }
34981    if (element.hasExpressionElement()) {
34982      composeStringCore("expression", element.getExpressionElement(), false);
34983      composeStringExtras("expression", element.getExpressionElement(), false);
34984    }
34985    if (element.hasXpathElement()) {
34986      composeStringCore("xpath", element.getXpathElement(), false);
34987      composeStringExtras("xpath", element.getXpathElement(), false);
34988    }
34989    if (element.hasSourceElement()) {
34990      composeCanonicalCore("source", element.getSourceElement(), false);
34991      composeCanonicalExtras("source", element.getSourceElement(), false);
34992    }
34993  }
34994
34995  protected void composeElementDefinitionElementDefinitionBindingComponent(String name,
34996      ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
34997    if (element != null) {
34998      open(name);
34999      composeElementDefinitionElementDefinitionBindingComponentInner(element);
35000      close();
35001    }
35002  }
35003
35004  protected void composeElementDefinitionElementDefinitionBindingComponentInner(
35005      ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
35006    composeElement(element);
35007    if (element.hasStrengthElement()) {
35008      composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(),
35009          false);
35010      composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(),
35011          false);
35012    }
35013    if (element.hasDescriptionElement()) {
35014      composeStringCore("description", element.getDescriptionElement(), false);
35015      composeStringExtras("description", element.getDescriptionElement(), false);
35016    }
35017    if (element.hasValueSetElement()) {
35018      composeCanonicalCore("valueSet", element.getValueSetElement(), false);
35019      composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
35020    }
35021  }
35022
35023  protected void composeElementDefinitionElementDefinitionMappingComponent(String name,
35024      ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
35025    if (element != null) {
35026      open(name);
35027      composeElementDefinitionElementDefinitionMappingComponentInner(element);
35028      close();
35029    }
35030  }
35031
35032  protected void composeElementDefinitionElementDefinitionMappingComponentInner(
35033      ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
35034    composeElement(element);
35035    if (element.hasIdentityElement()) {
35036      composeIdCore("identity", element.getIdentityElement(), false);
35037      composeIdExtras("identity", element.getIdentityElement(), false);
35038    }
35039    if (element.hasLanguageElement()) {
35040      composeCodeCore("language", element.getLanguageElement(), false);
35041      composeCodeExtras("language", element.getLanguageElement(), false);
35042    }
35043    if (element.hasMapElement()) {
35044      composeStringCore("map", element.getMapElement(), false);
35045      composeStringExtras("map", element.getMapElement(), false);
35046    }
35047    if (element.hasCommentElement()) {
35048      composeStringCore("comment", element.getCommentElement(), false);
35049      composeStringExtras("comment", element.getCommentElement(), false);
35050    }
35051  }
35052
35053  protected void composeDomainResourceElements(DomainResource element) throws IOException {
35054    composeResourceElements(element);
35055    if (element.hasText()) {
35056      composeNarrative("text", element.getText());
35057    }
35058    if (element.hasContained()) {
35059      openArray("contained");
35060      for (Resource e : element.getContained()) {
35061        open(null);
35062        composeResource(e);
35063        close();
35064      }
35065      closeArray();
35066    }
35067    ;
35068    if (element.hasExtension()) {
35069      openArray("extension");
35070      for (Extension e : element.getExtension())
35071        composeExtension(null, e);
35072      closeArray();
35073    }
35074    ;
35075    if (element.hasModifierExtension()) {
35076      openArray("modifierExtension");
35077      for (Extension e : element.getModifierExtension())
35078        composeExtension(null, e);
35079      closeArray();
35080    }
35081    ;
35082  }
35083
35084  protected void composeParameters(String name, Parameters element) throws IOException {
35085    if (element != null) {
35086      prop("resourceType", name);
35087      composeParametersInner(element);
35088    }
35089  }
35090
35091  protected void composeParametersInner(Parameters element) throws IOException {
35092    composeResourceElements(element);
35093    if (element.hasParameter()) {
35094      openArray("parameter");
35095      for (Parameters.ParametersParameterComponent e : element.getParameter())
35096        composeParametersParametersParameterComponent(null, e);
35097      closeArray();
35098    }
35099    ;
35100  }
35101
35102  protected void composeParametersParametersParameterComponent(String name,
35103      Parameters.ParametersParameterComponent element) throws IOException {
35104    if (element != null) {
35105      open(name);
35106      composeParametersParametersParameterComponentInner(element);
35107      close();
35108    }
35109  }
35110
35111  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element)
35112      throws IOException {
35113    composeBackbone(element);
35114    if (element.hasNameElement()) {
35115      composeStringCore("name", element.getNameElement(), false);
35116      composeStringExtras("name", element.getNameElement(), false);
35117    }
35118    if (element.hasValue()) {
35119      composeType("value", element.getValue());
35120    }
35121    if (element.hasResource()) {
35122      open("resource");
35123      composeResource(element.getResource());
35124      close();
35125    }
35126    if (element.hasPart()) {
35127      openArray("part");
35128      for (Parameters.ParametersParameterComponent e : element.getPart())
35129        composeParametersParametersParameterComponent(null, e);
35130      closeArray();
35131    }
35132    ;
35133  }
35134
35135  protected void composeResourceElements(Resource element) throws IOException {
35136    if (element.hasIdElement()) {
35137      composeIdCore("id", element.getIdElement(), false);
35138      composeIdExtras("id", element.getIdElement(), false);
35139    }
35140    if (element.hasMeta()) {
35141      composeMeta("meta", element.getMeta());
35142    }
35143    if (element.hasImplicitRulesElement()) {
35144      composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
35145      composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
35146    }
35147    if (element.hasLanguageElement()) {
35148      composeCodeCore("language", element.getLanguageElement(), false);
35149      composeCodeExtras("language", element.getLanguageElement(), false);
35150    }
35151  }
35152
35153  protected void composeAccount(String name, Account element) throws IOException {
35154    if (element != null) {
35155      prop("resourceType", name);
35156      composeAccountInner(element);
35157    }
35158  }
35159
35160  protected void composeAccountInner(Account element) throws IOException {
35161    composeDomainResourceElements(element);
35162    if (element.hasIdentifier()) {
35163      openArray("identifier");
35164      for (Identifier e : element.getIdentifier())
35165        composeIdentifier(null, e);
35166      closeArray();
35167    }
35168    ;
35169    if (element.hasStatusElement()) {
35170      composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
35171      composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
35172    }
35173    if (element.hasType()) {
35174      composeCodeableConcept("type", element.getType());
35175    }
35176    if (element.hasNameElement()) {
35177      composeStringCore("name", element.getNameElement(), false);
35178      composeStringExtras("name", element.getNameElement(), false);
35179    }
35180    if (element.hasSubject()) {
35181      openArray("subject");
35182      for (Reference e : element.getSubject())
35183        composeReference(null, e);
35184      closeArray();
35185    }
35186    ;
35187    if (element.hasServicePeriod()) {
35188      composePeriod("servicePeriod", element.getServicePeriod());
35189    }
35190    if (element.hasCoverage()) {
35191      openArray("coverage");
35192      for (Account.CoverageComponent e : element.getCoverage())
35193        composeAccountCoverageComponent(null, e);
35194      closeArray();
35195    }
35196    ;
35197    if (element.hasOwner()) {
35198      composeReference("owner", element.getOwner());
35199    }
35200    if (element.hasDescriptionElement()) {
35201      composeStringCore("description", element.getDescriptionElement(), false);
35202      composeStringExtras("description", element.getDescriptionElement(), false);
35203    }
35204    if (element.hasGuarantor()) {
35205      openArray("guarantor");
35206      for (Account.GuarantorComponent e : element.getGuarantor())
35207        composeAccountGuarantorComponent(null, e);
35208      closeArray();
35209    }
35210    ;
35211    if (element.hasPartOf()) {
35212      composeReference("partOf", element.getPartOf());
35213    }
35214  }
35215
35216  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
35217    if (element != null) {
35218      open(name);
35219      composeAccountCoverageComponentInner(element);
35220      close();
35221    }
35222  }
35223
35224  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
35225    composeBackbone(element);
35226    if (element.hasCoverage()) {
35227      composeReference("coverage", element.getCoverage());
35228    }
35229    if (element.hasPriorityElement()) {
35230      composePositiveIntCore("priority", element.getPriorityElement(), false);
35231      composePositiveIntExtras("priority", element.getPriorityElement(), false);
35232    }
35233  }
35234
35235  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
35236    if (element != null) {
35237      open(name);
35238      composeAccountGuarantorComponentInner(element);
35239      close();
35240    }
35241  }
35242
35243  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
35244    composeBackbone(element);
35245    if (element.hasParty()) {
35246      composeReference("party", element.getParty());
35247    }
35248    if (element.hasOnHoldElement()) {
35249      composeBooleanCore("onHold", element.getOnHoldElement(), false);
35250      composeBooleanExtras("onHold", element.getOnHoldElement(), false);
35251    }
35252    if (element.hasPeriod()) {
35253      composePeriod("period", element.getPeriod());
35254    }
35255  }
35256
35257  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
35258    if (element != null) {
35259      prop("resourceType", name);
35260      composeActivityDefinitionInner(element);
35261    }
35262  }
35263
35264  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
35265    composeDomainResourceElements(element);
35266    if (element.hasUrlElement()) {
35267      composeUriCore("url", element.getUrlElement(), false);
35268      composeUriExtras("url", element.getUrlElement(), false);
35269    }
35270    if (element.hasIdentifier()) {
35271      openArray("identifier");
35272      for (Identifier e : element.getIdentifier())
35273        composeIdentifier(null, e);
35274      closeArray();
35275    }
35276    ;
35277    if (element.hasVersionElement()) {
35278      composeStringCore("version", element.getVersionElement(), false);
35279      composeStringExtras("version", element.getVersionElement(), false);
35280    }
35281    if (element.hasNameElement()) {
35282      composeStringCore("name", element.getNameElement(), false);
35283      composeStringExtras("name", element.getNameElement(), false);
35284    }
35285    if (element.hasTitleElement()) {
35286      composeStringCore("title", element.getTitleElement(), false);
35287      composeStringExtras("title", element.getTitleElement(), false);
35288    }
35289    if (element.hasSubtitleElement()) {
35290      composeStringCore("subtitle", element.getSubtitleElement(), false);
35291      composeStringExtras("subtitle", element.getSubtitleElement(), false);
35292    }
35293    if (element.hasStatusElement()) {
35294      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
35295          false);
35296      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
35297          false);
35298    }
35299    if (element.hasExperimentalElement()) {
35300      composeBooleanCore("experimental", element.getExperimentalElement(), false);
35301      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35302    }
35303    if (element.hasSubject()) {
35304      composeType("subject", element.getSubject());
35305    }
35306    if (element.hasDateElement()) {
35307      composeDateTimeCore("date", element.getDateElement(), false);
35308      composeDateTimeExtras("date", element.getDateElement(), false);
35309    }
35310    if (element.hasPublisherElement()) {
35311      composeStringCore("publisher", element.getPublisherElement(), false);
35312      composeStringExtras("publisher", element.getPublisherElement(), false);
35313    }
35314    if (element.hasContact()) {
35315      openArray("contact");
35316      for (ContactDetail e : element.getContact())
35317        composeContactDetail(null, e);
35318      closeArray();
35319    }
35320    ;
35321    if (element.hasDescriptionElement()) {
35322      composeMarkdownCore("description", element.getDescriptionElement(), false);
35323      composeMarkdownExtras("description", element.getDescriptionElement(), false);
35324    }
35325    if (element.hasUseContext()) {
35326      openArray("useContext");
35327      for (UsageContext e : element.getUseContext())
35328        composeUsageContext(null, e);
35329      closeArray();
35330    }
35331    ;
35332    if (element.hasJurisdiction()) {
35333      openArray("jurisdiction");
35334      for (CodeableConcept e : element.getJurisdiction())
35335        composeCodeableConcept(null, e);
35336      closeArray();
35337    }
35338    ;
35339    if (element.hasPurposeElement()) {
35340      composeMarkdownCore("purpose", element.getPurposeElement(), false);
35341      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35342    }
35343    if (element.hasUsageElement()) {
35344      composeStringCore("usage", element.getUsageElement(), false);
35345      composeStringExtras("usage", element.getUsageElement(), false);
35346    }
35347    if (element.hasCopyrightElement()) {
35348      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35349      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35350    }
35351    if (element.hasApprovalDateElement()) {
35352      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
35353      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
35354    }
35355    if (element.hasLastReviewDateElement()) {
35356      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
35357      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
35358    }
35359    if (element.hasEffectivePeriod()) {
35360      composePeriod("effectivePeriod", element.getEffectivePeriod());
35361    }
35362    if (element.hasTopic()) {
35363      openArray("topic");
35364      for (CodeableConcept e : element.getTopic())
35365        composeCodeableConcept(null, e);
35366      closeArray();
35367    }
35368    ;
35369    if (element.hasAuthor()) {
35370      openArray("author");
35371      for (ContactDetail e : element.getAuthor())
35372        composeContactDetail(null, e);
35373      closeArray();
35374    }
35375    ;
35376    if (element.hasEditor()) {
35377      openArray("editor");
35378      for (ContactDetail e : element.getEditor())
35379        composeContactDetail(null, e);
35380      closeArray();
35381    }
35382    ;
35383    if (element.hasReviewer()) {
35384      openArray("reviewer");
35385      for (ContactDetail e : element.getReviewer())
35386        composeContactDetail(null, e);
35387      closeArray();
35388    }
35389    ;
35390    if (element.hasEndorser()) {
35391      openArray("endorser");
35392      for (ContactDetail e : element.getEndorser())
35393        composeContactDetail(null, e);
35394      closeArray();
35395    }
35396    ;
35397    if (element.hasRelatedArtifact()) {
35398      openArray("relatedArtifact");
35399      for (RelatedArtifact e : element.getRelatedArtifact())
35400        composeRelatedArtifact(null, e);
35401      closeArray();
35402    }
35403    ;
35404    if (element.hasLibrary()) {
35405      openArray("library");
35406      for (CanonicalType e : element.getLibrary())
35407        composeCanonicalCore(null, e, true);
35408      closeArray();
35409      if (anyHasExtras(element.getLibrary())) {
35410        openArray("_library");
35411        for (CanonicalType e : element.getLibrary())
35412          composeCanonicalExtras(null, e, true);
35413        closeArray();
35414      }
35415    }
35416    ;
35417    if (element.hasKindElement()) {
35418      composeEnumerationCore("kind", element.getKindElement(),
35419          new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
35420      composeEnumerationExtras("kind", element.getKindElement(),
35421          new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
35422    }
35423    if (element.hasProfileElement()) {
35424      composeCanonicalCore("profile", element.getProfileElement(), false);
35425      composeCanonicalExtras("profile", element.getProfileElement(), false);
35426    }
35427    if (element.hasCode()) {
35428      composeCodeableConcept("code", element.getCode());
35429    }
35430    if (element.hasIntentElement()) {
35431      composeEnumerationCore("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(),
35432          false);
35433      composeEnumerationExtras("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(),
35434          false);
35435    }
35436    if (element.hasPriorityElement()) {
35437      composeEnumerationCore("priority", element.getPriorityElement(),
35438          new ActivityDefinition.RequestPriorityEnumFactory(), false);
35439      composeEnumerationExtras("priority", element.getPriorityElement(),
35440          new ActivityDefinition.RequestPriorityEnumFactory(), false);
35441    }
35442    if (element.hasDoNotPerformElement()) {
35443      composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
35444      composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
35445    }
35446    if (element.hasTiming()) {
35447      composeType("timing", element.getTiming());
35448    }
35449    if (element.hasLocation()) {
35450      composeReference("location", element.getLocation());
35451    }
35452    if (element.hasParticipant()) {
35453      openArray("participant");
35454      for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant())
35455        composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
35456      closeArray();
35457    }
35458    ;
35459    if (element.hasProduct()) {
35460      composeType("product", element.getProduct());
35461    }
35462    if (element.hasQuantity()) {
35463      composeQuantity("quantity", element.getQuantity());
35464    }
35465    if (element.hasDosage()) {
35466      openArray("dosage");
35467      for (Dosage e : element.getDosage())
35468        composeDosage(null, e);
35469      closeArray();
35470    }
35471    ;
35472    if (element.hasBodySite()) {
35473      openArray("bodySite");
35474      for (CodeableConcept e : element.getBodySite())
35475        composeCodeableConcept(null, e);
35476      closeArray();
35477    }
35478    ;
35479    if (element.hasSpecimenRequirement()) {
35480      openArray("specimenRequirement");
35481      for (Reference e : element.getSpecimenRequirement())
35482        composeReference(null, e);
35483      closeArray();
35484    }
35485    ;
35486    if (element.hasObservationRequirement()) {
35487      openArray("observationRequirement");
35488      for (Reference e : element.getObservationRequirement())
35489        composeReference(null, e);
35490      closeArray();
35491    }
35492    ;
35493    if (element.hasObservationResultRequirement()) {
35494      openArray("observationResultRequirement");
35495      for (Reference e : element.getObservationResultRequirement())
35496        composeReference(null, e);
35497      closeArray();
35498    }
35499    ;
35500    if (element.hasTransformElement()) {
35501      composeCanonicalCore("transform", element.getTransformElement(), false);
35502      composeCanonicalExtras("transform", element.getTransformElement(), false);
35503    }
35504    if (element.hasDynamicValue()) {
35505      openArray("dynamicValue");
35506      for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue())
35507        composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
35508      closeArray();
35509    }
35510    ;
35511  }
35512
35513  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name,
35514      ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
35515    if (element != null) {
35516      open(name);
35517      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
35518      close();
35519    }
35520  }
35521
35522  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(
35523      ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
35524    composeBackbone(element);
35525    if (element.hasTypeElement()) {
35526      composeEnumerationCore("type", element.getTypeElement(),
35527          new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
35528      composeEnumerationExtras("type", element.getTypeElement(),
35529          new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
35530    }
35531    if (element.hasRole()) {
35532      composeCodeableConcept("role", element.getRole());
35533    }
35534  }
35535
35536  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name,
35537      ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
35538    if (element != null) {
35539      open(name);
35540      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
35541      close();
35542    }
35543  }
35544
35545  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(
35546      ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
35547    composeBackbone(element);
35548    if (element.hasPathElement()) {
35549      composeStringCore("path", element.getPathElement(), false);
35550      composeStringExtras("path", element.getPathElement(), false);
35551    }
35552    if (element.hasExpression()) {
35553      composeExpression("expression", element.getExpression());
35554    }
35555  }
35556
35557  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
35558    if (element != null) {
35559      prop("resourceType", name);
35560      composeAdverseEventInner(element);
35561    }
35562  }
35563
35564  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
35565    composeDomainResourceElements(element);
35566    if (element.hasIdentifier()) {
35567      composeIdentifier("identifier", element.getIdentifier());
35568    }
35569    if (element.hasActualityElement()) {
35570      composeEnumerationCore("actuality", element.getActualityElement(),
35571          new AdverseEvent.AdverseEventActualityEnumFactory(), false);
35572      composeEnumerationExtras("actuality", element.getActualityElement(),
35573          new AdverseEvent.AdverseEventActualityEnumFactory(), false);
35574    }
35575    if (element.hasCategory()) {
35576      openArray("category");
35577      for (CodeableConcept e : element.getCategory())
35578        composeCodeableConcept(null, e);
35579      closeArray();
35580    }
35581    ;
35582    if (element.hasEvent()) {
35583      composeCodeableConcept("event", element.getEvent());
35584    }
35585    if (element.hasSubject()) {
35586      composeReference("subject", element.getSubject());
35587    }
35588    if (element.hasEncounter()) {
35589      composeReference("encounter", element.getEncounter());
35590    }
35591    if (element.hasDateElement()) {
35592      composeDateTimeCore("date", element.getDateElement(), false);
35593      composeDateTimeExtras("date", element.getDateElement(), false);
35594    }
35595    if (element.hasDetectedElement()) {
35596      composeDateTimeCore("detected", element.getDetectedElement(), false);
35597      composeDateTimeExtras("detected", element.getDetectedElement(), false);
35598    }
35599    if (element.hasRecordedDateElement()) {
35600      composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
35601      composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
35602    }
35603    if (element.hasResultingCondition()) {
35604      openArray("resultingCondition");
35605      for (Reference e : element.getResultingCondition())
35606        composeReference(null, e);
35607      closeArray();
35608    }
35609    ;
35610    if (element.hasLocation()) {
35611      composeReference("location", element.getLocation());
35612    }
35613    if (element.hasSeriousness()) {
35614      composeCodeableConcept("seriousness", element.getSeriousness());
35615    }
35616    if (element.hasSeverity()) {
35617      composeCodeableConcept("severity", element.getSeverity());
35618    }
35619    if (element.hasOutcome()) {
35620      composeCodeableConcept("outcome", element.getOutcome());
35621    }
35622    if (element.hasRecorder()) {
35623      composeReference("recorder", element.getRecorder());
35624    }
35625    if (element.hasContributor()) {
35626      openArray("contributor");
35627      for (Reference e : element.getContributor())
35628        composeReference(null, e);
35629      closeArray();
35630    }
35631    ;
35632    if (element.hasSuspectEntity()) {
35633      openArray("suspectEntity");
35634      for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity())
35635        composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
35636      closeArray();
35637    }
35638    ;
35639    if (element.hasSubjectMedicalHistory()) {
35640      openArray("subjectMedicalHistory");
35641      for (Reference e : element.getSubjectMedicalHistory())
35642        composeReference(null, e);
35643      closeArray();
35644    }
35645    ;
35646    if (element.hasReferenceDocument()) {
35647      openArray("referenceDocument");
35648      for (Reference e : element.getReferenceDocument())
35649        composeReference(null, e);
35650      closeArray();
35651    }
35652    ;
35653    if (element.hasStudy()) {
35654      openArray("study");
35655      for (Reference e : element.getStudy())
35656        composeReference(null, e);
35657      closeArray();
35658    }
35659    ;
35660  }
35661
35662  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name,
35663      AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
35664    if (element != null) {
35665      open(name);
35666      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
35667      close();
35668    }
35669  }
35670
35671  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(
35672      AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
35673    composeBackbone(element);
35674    if (element.hasInstance()) {
35675      composeReference("instance", element.getInstance());
35676    }
35677    if (element.hasCausality()) {
35678      openArray("causality");
35679      for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality())
35680        composeAdverseEventAdverseEventSuspectEntityCausalityComponent(null, e);
35681      closeArray();
35682    }
35683    ;
35684  }
35685
35686  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name,
35687      AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
35688    if (element != null) {
35689      open(name);
35690      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
35691      close();
35692    }
35693  }
35694
35695  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(
35696      AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
35697    composeBackbone(element);
35698    if (element.hasAssessment()) {
35699      composeCodeableConcept("assessment", element.getAssessment());
35700    }
35701    if (element.hasProductRelatednessElement()) {
35702      composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
35703      composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
35704    }
35705    if (element.hasAuthor()) {
35706      composeReference("author", element.getAuthor());
35707    }
35708    if (element.hasMethod()) {
35709      composeCodeableConcept("method", element.getMethod());
35710    }
35711  }
35712
35713  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
35714    if (element != null) {
35715      prop("resourceType", name);
35716      composeAllergyIntoleranceInner(element);
35717    }
35718  }
35719
35720  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
35721    composeDomainResourceElements(element);
35722    if (element.hasIdentifier()) {
35723      openArray("identifier");
35724      for (Identifier e : element.getIdentifier())
35725        composeIdentifier(null, e);
35726      closeArray();
35727    }
35728    ;
35729    if (element.hasClinicalStatus()) {
35730      composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
35731    }
35732    if (element.hasVerificationStatus()) {
35733      composeCodeableConcept("verificationStatus", element.getVerificationStatus());
35734    }
35735    if (element.hasTypeElement()) {
35736      composeEnumerationCore("type", element.getTypeElement(),
35737          new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
35738      composeEnumerationExtras("type", element.getTypeElement(),
35739          new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
35740    }
35741    if (element.hasCategory()) {
35742      openArray("category");
35743      for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory())
35744        composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
35745      closeArray();
35746      if (anyHasExtras(element.getCategory())) {
35747        openArray("_category");
35748        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory())
35749          composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
35750        closeArray();
35751      }
35752    }
35753    ;
35754    if (element.hasCriticalityElement()) {
35755      composeEnumerationCore("criticality", element.getCriticalityElement(),
35756          new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
35757      composeEnumerationExtras("criticality", element.getCriticalityElement(),
35758          new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
35759    }
35760    if (element.hasCode()) {
35761      composeCodeableConcept("code", element.getCode());
35762    }
35763    if (element.hasPatient()) {
35764      composeReference("patient", element.getPatient());
35765    }
35766    if (element.hasEncounter()) {
35767      composeReference("encounter", element.getEncounter());
35768    }
35769    if (element.hasOnset()) {
35770      composeType("onset", element.getOnset());
35771    }
35772    if (element.hasRecordedDateElement()) {
35773      composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
35774      composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
35775    }
35776    if (element.hasRecorder()) {
35777      composeReference("recorder", element.getRecorder());
35778    }
35779    if (element.hasAsserter()) {
35780      composeReference("asserter", element.getAsserter());
35781    }
35782    if (element.hasLastOccurrenceElement()) {
35783      composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
35784      composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
35785    }
35786    if (element.hasNote()) {
35787      openArray("note");
35788      for (Annotation e : element.getNote())
35789        composeAnnotation(null, e);
35790      closeArray();
35791    }
35792    ;
35793    if (element.hasReaction()) {
35794      openArray("reaction");
35795      for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction())
35796        composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
35797      closeArray();
35798    }
35799    ;
35800  }
35801
35802  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name,
35803      AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
35804    if (element != null) {
35805      open(name);
35806      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
35807      close();
35808    }
35809  }
35810
35811  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(
35812      AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
35813    composeBackbone(element);
35814    if (element.hasSubstance()) {
35815      composeCodeableConcept("substance", element.getSubstance());
35816    }
35817    if (element.hasManifestation()) {
35818      openArray("manifestation");
35819      for (CodeableConcept e : element.getManifestation())
35820        composeCodeableConcept(null, e);
35821      closeArray();
35822    }
35823    ;
35824    if (element.hasDescriptionElement()) {
35825      composeStringCore("description", element.getDescriptionElement(), false);
35826      composeStringExtras("description", element.getDescriptionElement(), false);
35827    }
35828    if (element.hasOnsetElement()) {
35829      composeDateTimeCore("onset", element.getOnsetElement(), false);
35830      composeDateTimeExtras("onset", element.getOnsetElement(), false);
35831    }
35832    if (element.hasSeverityElement()) {
35833      composeEnumerationCore("severity", element.getSeverityElement(),
35834          new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
35835      composeEnumerationExtras("severity", element.getSeverityElement(),
35836          new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
35837    }
35838    if (element.hasExposureRoute()) {
35839      composeCodeableConcept("exposureRoute", element.getExposureRoute());
35840    }
35841    if (element.hasNote()) {
35842      openArray("note");
35843      for (Annotation e : element.getNote())
35844        composeAnnotation(null, e);
35845      closeArray();
35846    }
35847    ;
35848  }
35849
35850  protected void composeAppointment(String name, Appointment element) throws IOException {
35851    if (element != null) {
35852      prop("resourceType", name);
35853      composeAppointmentInner(element);
35854    }
35855  }
35856
35857  protected void composeAppointmentInner(Appointment element) throws IOException {
35858    composeDomainResourceElements(element);
35859    if (element.hasIdentifier()) {
35860      openArray("identifier");
35861      for (Identifier e : element.getIdentifier())
35862        composeIdentifier(null, e);
35863      closeArray();
35864    }
35865    ;
35866    if (element.hasStatusElement()) {
35867      composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(),
35868          false);
35869      composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(),
35870          false);
35871    }
35872    if (element.hasCancelationReason()) {
35873      composeCodeableConcept("cancelationReason", element.getCancelationReason());
35874    }
35875    if (element.hasServiceCategory()) {
35876      openArray("serviceCategory");
35877      for (CodeableConcept e : element.getServiceCategory())
35878        composeCodeableConcept(null, e);
35879      closeArray();
35880    }
35881    ;
35882    if (element.hasServiceType()) {
35883      openArray("serviceType");
35884      for (CodeableConcept e : element.getServiceType())
35885        composeCodeableConcept(null, e);
35886      closeArray();
35887    }
35888    ;
35889    if (element.hasSpecialty()) {
35890      openArray("specialty");
35891      for (CodeableConcept e : element.getSpecialty())
35892        composeCodeableConcept(null, e);
35893      closeArray();
35894    }
35895    ;
35896    if (element.hasAppointmentType()) {
35897      composeCodeableConcept("appointmentType", element.getAppointmentType());
35898    }
35899    if (element.hasReasonCode()) {
35900      openArray("reasonCode");
35901      for (CodeableConcept e : element.getReasonCode())
35902        composeCodeableConcept(null, e);
35903      closeArray();
35904    }
35905    ;
35906    if (element.hasReasonReference()) {
35907      openArray("reasonReference");
35908      for (Reference e : element.getReasonReference())
35909        composeReference(null, e);
35910      closeArray();
35911    }
35912    ;
35913    if (element.hasPriorityElement()) {
35914      composeUnsignedIntCore("priority", element.getPriorityElement(), false);
35915      composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
35916    }
35917    if (element.hasDescriptionElement()) {
35918      composeStringCore("description", element.getDescriptionElement(), false);
35919      composeStringExtras("description", element.getDescriptionElement(), false);
35920    }
35921    if (element.hasSupportingInformation()) {
35922      openArray("supportingInformation");
35923      for (Reference e : element.getSupportingInformation())
35924        composeReference(null, e);
35925      closeArray();
35926    }
35927    ;
35928    if (element.hasStartElement()) {
35929      composeInstantCore("start", element.getStartElement(), false);
35930      composeInstantExtras("start", element.getStartElement(), false);
35931    }
35932    if (element.hasEndElement()) {
35933      composeInstantCore("end", element.getEndElement(), false);
35934      composeInstantExtras("end", element.getEndElement(), false);
35935    }
35936    if (element.hasMinutesDurationElement()) {
35937      composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
35938      composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
35939    }
35940    if (element.hasSlot()) {
35941      openArray("slot");
35942      for (Reference e : element.getSlot())
35943        composeReference(null, e);
35944      closeArray();
35945    }
35946    ;
35947    if (element.hasCreatedElement()) {
35948      composeDateTimeCore("created", element.getCreatedElement(), false);
35949      composeDateTimeExtras("created", element.getCreatedElement(), false);
35950    }
35951    if (element.hasCommentElement()) {
35952      composeStringCore("comment", element.getCommentElement(), false);
35953      composeStringExtras("comment", element.getCommentElement(), false);
35954    }
35955    if (element.hasPatientInstructionElement()) {
35956      composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
35957      composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
35958    }
35959    if (element.hasBasedOn()) {
35960      openArray("basedOn");
35961      for (Reference e : element.getBasedOn())
35962        composeReference(null, e);
35963      closeArray();
35964    }
35965    ;
35966    if (element.hasParticipant()) {
35967      openArray("participant");
35968      for (Appointment.AppointmentParticipantComponent e : element.getParticipant())
35969        composeAppointmentAppointmentParticipantComponent(null, e);
35970      closeArray();
35971    }
35972    ;
35973    if (element.hasRequestedPeriod()) {
35974      openArray("requestedPeriod");
35975      for (Period e : element.getRequestedPeriod())
35976        composePeriod(null, e);
35977      closeArray();
35978    }
35979    ;
35980  }
35981
35982  protected void composeAppointmentAppointmentParticipantComponent(String name,
35983      Appointment.AppointmentParticipantComponent element) throws IOException {
35984    if (element != null) {
35985      open(name);
35986      composeAppointmentAppointmentParticipantComponentInner(element);
35987      close();
35988    }
35989  }
35990
35991  protected void composeAppointmentAppointmentParticipantComponentInner(
35992      Appointment.AppointmentParticipantComponent element) throws IOException {
35993    composeBackbone(element);
35994    if (element.hasType()) {
35995      openArray("type");
35996      for (CodeableConcept e : element.getType())
35997        composeCodeableConcept(null, e);
35998      closeArray();
35999    }
36000    ;
36001    if (element.hasActor()) {
36002      composeReference("actor", element.getActor());
36003    }
36004    if (element.hasRequiredElement()) {
36005      composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(),
36006          false);
36007      composeEnumerationExtras("required", element.getRequiredElement(),
36008          new Appointment.ParticipantRequiredEnumFactory(), false);
36009    }
36010    if (element.hasStatusElement()) {
36011      composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(),
36012          false);
36013      composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(),
36014          false);
36015    }
36016    if (element.hasPeriod()) {
36017      composePeriod("period", element.getPeriod());
36018    }
36019  }
36020
36021  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
36022    if (element != null) {
36023      prop("resourceType", name);
36024      composeAppointmentResponseInner(element);
36025    }
36026  }
36027
36028  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
36029    composeDomainResourceElements(element);
36030    if (element.hasIdentifier()) {
36031      openArray("identifier");
36032      for (Identifier e : element.getIdentifier())
36033        composeIdentifier(null, e);
36034      closeArray();
36035    }
36036    ;
36037    if (element.hasAppointment()) {
36038      composeReference("appointment", element.getAppointment());
36039    }
36040    if (element.hasStartElement()) {
36041      composeInstantCore("start", element.getStartElement(), false);
36042      composeInstantExtras("start", element.getStartElement(), false);
36043    }
36044    if (element.hasEndElement()) {
36045      composeInstantCore("end", element.getEndElement(), false);
36046      composeInstantExtras("end", element.getEndElement(), false);
36047    }
36048    if (element.hasParticipantType()) {
36049      openArray("participantType");
36050      for (CodeableConcept e : element.getParticipantType())
36051        composeCodeableConcept(null, e);
36052      closeArray();
36053    }
36054    ;
36055    if (element.hasActor()) {
36056      composeReference("actor", element.getActor());
36057    }
36058    if (element.hasParticipantStatusElement()) {
36059      composeEnumerationCore("participantStatus", element.getParticipantStatusElement(),
36060          new AppointmentResponse.ParticipantStatusEnumFactory(), false);
36061      composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(),
36062          new AppointmentResponse.ParticipantStatusEnumFactory(), false);
36063    }
36064    if (element.hasCommentElement()) {
36065      composeStringCore("comment", element.getCommentElement(), false);
36066      composeStringExtras("comment", element.getCommentElement(), false);
36067    }
36068  }
36069
36070  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
36071    if (element != null) {
36072      prop("resourceType", name);
36073      composeAuditEventInner(element);
36074    }
36075  }
36076
36077  protected void composeAuditEventInner(AuditEvent element) throws IOException {
36078    composeDomainResourceElements(element);
36079    if (element.hasType()) {
36080      composeCoding("type", element.getType());
36081    }
36082    if (element.hasSubtype()) {
36083      openArray("subtype");
36084      for (Coding e : element.getSubtype())
36085        composeCoding(null, e);
36086      closeArray();
36087    }
36088    ;
36089    if (element.hasActionElement()) {
36090      composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
36091      composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(),
36092          false);
36093    }
36094    if (element.hasPeriod()) {
36095      composePeriod("period", element.getPeriod());
36096    }
36097    if (element.hasRecordedElement()) {
36098      composeInstantCore("recorded", element.getRecordedElement(), false);
36099      composeInstantExtras("recorded", element.getRecordedElement(), false);
36100    }
36101    if (element.hasOutcomeElement()) {
36102      composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(),
36103          false);
36104      composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(),
36105          false);
36106    }
36107    if (element.hasOutcomeDescElement()) {
36108      composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
36109      composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
36110    }
36111    if (element.hasPurposeOfEvent()) {
36112      openArray("purposeOfEvent");
36113      for (CodeableConcept e : element.getPurposeOfEvent())
36114        composeCodeableConcept(null, e);
36115      closeArray();
36116    }
36117    ;
36118    if (element.hasAgent()) {
36119      openArray("agent");
36120      for (AuditEvent.AuditEventAgentComponent e : element.getAgent())
36121        composeAuditEventAuditEventAgentComponent(null, e);
36122      closeArray();
36123    }
36124    ;
36125    if (element.hasSource()) {
36126      composeAuditEventAuditEventSourceComponent("source", element.getSource());
36127    }
36128    if (element.hasEntity()) {
36129      openArray("entity");
36130      for (AuditEvent.AuditEventEntityComponent e : element.getEntity())
36131        composeAuditEventAuditEventEntityComponent(null, e);
36132      closeArray();
36133    }
36134    ;
36135  }
36136
36137  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element)
36138      throws IOException {
36139    if (element != null) {
36140      open(name);
36141      composeAuditEventAuditEventAgentComponentInner(element);
36142      close();
36143    }
36144  }
36145
36146  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element)
36147      throws IOException {
36148    composeBackbone(element);
36149    if (element.hasType()) {
36150      composeCodeableConcept("type", element.getType());
36151    }
36152    if (element.hasRole()) {
36153      openArray("role");
36154      for (CodeableConcept e : element.getRole())
36155        composeCodeableConcept(null, e);
36156      closeArray();
36157    }
36158    ;
36159    if (element.hasWho()) {
36160      composeReference("who", element.getWho());
36161    }
36162    if (element.hasAltIdElement()) {
36163      composeStringCore("altId", element.getAltIdElement(), false);
36164      composeStringExtras("altId", element.getAltIdElement(), false);
36165    }
36166    if (element.hasNameElement()) {
36167      composeStringCore("name", element.getNameElement(), false);
36168      composeStringExtras("name", element.getNameElement(), false);
36169    }
36170    if (element.hasRequestorElement()) {
36171      composeBooleanCore("requestor", element.getRequestorElement(), false);
36172      composeBooleanExtras("requestor", element.getRequestorElement(), false);
36173    }
36174    if (element.hasLocation()) {
36175      composeReference("location", element.getLocation());
36176    }
36177    if (element.hasPolicy()) {
36178      openArray("policy");
36179      for (UriType e : element.getPolicy())
36180        composeUriCore(null, e, true);
36181      closeArray();
36182      if (anyHasExtras(element.getPolicy())) {
36183        openArray("_policy");
36184        for (UriType e : element.getPolicy())
36185          composeUriExtras(null, e, true);
36186        closeArray();
36187      }
36188    }
36189    ;
36190    if (element.hasMedia()) {
36191      composeCoding("media", element.getMedia());
36192    }
36193    if (element.hasNetwork()) {
36194      composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
36195    }
36196    if (element.hasPurposeOfUse()) {
36197      openArray("purposeOfUse");
36198      for (CodeableConcept e : element.getPurposeOfUse())
36199        composeCodeableConcept(null, e);
36200      closeArray();
36201    }
36202    ;
36203  }
36204
36205  protected void composeAuditEventAuditEventAgentNetworkComponent(String name,
36206      AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
36207    if (element != null) {
36208      open(name);
36209      composeAuditEventAuditEventAgentNetworkComponentInner(element);
36210      close();
36211    }
36212  }
36213
36214  protected void composeAuditEventAuditEventAgentNetworkComponentInner(
36215      AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
36216    composeBackbone(element);
36217    if (element.hasAddressElement()) {
36218      composeStringCore("address", element.getAddressElement(), false);
36219      composeStringExtras("address", element.getAddressElement(), false);
36220    }
36221    if (element.hasTypeElement()) {
36222      composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(),
36223          false);
36224      composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(),
36225          false);
36226    }
36227  }
36228
36229  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element)
36230      throws IOException {
36231    if (element != null) {
36232      open(name);
36233      composeAuditEventAuditEventSourceComponentInner(element);
36234      close();
36235    }
36236  }
36237
36238  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element)
36239      throws IOException {
36240    composeBackbone(element);
36241    if (element.hasSiteElement()) {
36242      composeStringCore("site", element.getSiteElement(), false);
36243      composeStringExtras("site", element.getSiteElement(), false);
36244    }
36245    if (element.hasObserver()) {
36246      composeReference("observer", element.getObserver());
36247    }
36248    if (element.hasType()) {
36249      openArray("type");
36250      for (Coding e : element.getType())
36251        composeCoding(null, e);
36252      closeArray();
36253    }
36254    ;
36255  }
36256
36257  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element)
36258      throws IOException {
36259    if (element != null) {
36260      open(name);
36261      composeAuditEventAuditEventEntityComponentInner(element);
36262      close();
36263    }
36264  }
36265
36266  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element)
36267      throws IOException {
36268    composeBackbone(element);
36269    if (element.hasWhat()) {
36270      composeReference("what", element.getWhat());
36271    }
36272    if (element.hasType()) {
36273      composeCoding("type", element.getType());
36274    }
36275    if (element.hasRole()) {
36276      composeCoding("role", element.getRole());
36277    }
36278    if (element.hasLifecycle()) {
36279      composeCoding("lifecycle", element.getLifecycle());
36280    }
36281    if (element.hasSecurityLabel()) {
36282      openArray("securityLabel");
36283      for (Coding e : element.getSecurityLabel())
36284        composeCoding(null, e);
36285      closeArray();
36286    }
36287    ;
36288    if (element.hasNameElement()) {
36289      composeStringCore("name", element.getNameElement(), false);
36290      composeStringExtras("name", element.getNameElement(), false);
36291    }
36292    if (element.hasDescriptionElement()) {
36293      composeStringCore("description", element.getDescriptionElement(), false);
36294      composeStringExtras("description", element.getDescriptionElement(), false);
36295    }
36296    if (element.hasQueryElement()) {
36297      composeBase64BinaryCore("query", element.getQueryElement(), false);
36298      composeBase64BinaryExtras("query", element.getQueryElement(), false);
36299    }
36300    if (element.hasDetail()) {
36301      openArray("detail");
36302      for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail())
36303        composeAuditEventAuditEventEntityDetailComponent(null, e);
36304      closeArray();
36305    }
36306    ;
36307  }
36308
36309  protected void composeAuditEventAuditEventEntityDetailComponent(String name,
36310      AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
36311    if (element != null) {
36312      open(name);
36313      composeAuditEventAuditEventEntityDetailComponentInner(element);
36314      close();
36315    }
36316  }
36317
36318  protected void composeAuditEventAuditEventEntityDetailComponentInner(
36319      AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
36320    composeBackbone(element);
36321    if (element.hasTypeElement()) {
36322      composeStringCore("type", element.getTypeElement(), false);
36323      composeStringExtras("type", element.getTypeElement(), false);
36324    }
36325    if (element.hasValue()) {
36326      composeType("value", element.getValue());
36327    }
36328  }
36329
36330  protected void composeBasic(String name, Basic element) throws IOException {
36331    if (element != null) {
36332      prop("resourceType", name);
36333      composeBasicInner(element);
36334    }
36335  }
36336
36337  protected void composeBasicInner(Basic element) throws IOException {
36338    composeDomainResourceElements(element);
36339    if (element.hasIdentifier()) {
36340      openArray("identifier");
36341      for (Identifier e : element.getIdentifier())
36342        composeIdentifier(null, e);
36343      closeArray();
36344    }
36345    ;
36346    if (element.hasCode()) {
36347      composeCodeableConcept("code", element.getCode());
36348    }
36349    if (element.hasSubject()) {
36350      composeReference("subject", element.getSubject());
36351    }
36352    if (element.hasCreatedElement()) {
36353      composeDateCore("created", element.getCreatedElement(), false);
36354      composeDateExtras("created", element.getCreatedElement(), false);
36355    }
36356    if (element.hasAuthor()) {
36357      composeReference("author", element.getAuthor());
36358    }
36359  }
36360
36361  protected void composeBinary(String name, Binary element) throws IOException {
36362    if (element != null) {
36363      prop("resourceType", name);
36364      composeBinaryInner(element);
36365    }
36366  }
36367
36368  protected void composeBinaryInner(Binary element) throws IOException {
36369    composeResourceElements(element);
36370    if (element.hasContentTypeElement()) {
36371      composeCodeCore("contentType", element.getContentTypeElement(), false);
36372      composeCodeExtras("contentType", element.getContentTypeElement(), false);
36373    }
36374    if (element.hasSecurityContext()) {
36375      composeReference("securityContext", element.getSecurityContext());
36376    }
36377    if (element.hasDataElement()) {
36378      composeBase64BinaryCore("data", element.getDataElement(), false);
36379      composeBase64BinaryExtras("data", element.getDataElement(), false);
36380    }
36381  }
36382
36383  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
36384    if (element != null) {
36385      prop("resourceType", name);
36386      composeBiologicallyDerivedProductInner(element);
36387    }
36388  }
36389
36390  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
36391    composeDomainResourceElements(element);
36392    if (element.hasIdentifier()) {
36393      openArray("identifier");
36394      for (Identifier e : element.getIdentifier())
36395        composeIdentifier(null, e);
36396      closeArray();
36397    }
36398    ;
36399    if (element.hasProductCategoryElement()) {
36400      composeEnumerationCore("productCategory", element.getProductCategoryElement(),
36401          new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
36402      composeEnumerationExtras("productCategory", element.getProductCategoryElement(),
36403          new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
36404    }
36405    if (element.hasProductCode()) {
36406      composeCodeableConcept("productCode", element.getProductCode());
36407    }
36408    if (element.hasStatusElement()) {
36409      composeEnumerationCore("status", element.getStatusElement(),
36410          new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
36411      composeEnumerationExtras("status", element.getStatusElement(),
36412          new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
36413    }
36414    if (element.hasRequest()) {
36415      openArray("request");
36416      for (Reference e : element.getRequest())
36417        composeReference(null, e);
36418      closeArray();
36419    }
36420    ;
36421    if (element.hasQuantityElement()) {
36422      composeIntegerCore("quantity", element.getQuantityElement(), false);
36423      composeIntegerExtras("quantity", element.getQuantityElement(), false);
36424    }
36425    if (element.hasParent()) {
36426      openArray("parent");
36427      for (Reference e : element.getParent())
36428        composeReference(null, e);
36429      closeArray();
36430    }
36431    ;
36432    if (element.hasCollection()) {
36433      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection",
36434          element.getCollection());
36435    }
36436    if (element.hasProcessing()) {
36437      openArray("processing");
36438      for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing())
36439        composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
36440      closeArray();
36441    }
36442    ;
36443    if (element.hasManipulation()) {
36444      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation",
36445          element.getManipulation());
36446    }
36447    if (element.hasStorage()) {
36448      openArray("storage");
36449      for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage())
36450        composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
36451      closeArray();
36452    }
36453    ;
36454  }
36455
36456  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name,
36457      BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
36458    if (element != null) {
36459      open(name);
36460      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
36461      close();
36462    }
36463  }
36464
36465  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(
36466      BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
36467    composeBackbone(element);
36468    if (element.hasCollector()) {
36469      composeReference("collector", element.getCollector());
36470    }
36471    if (element.hasSource()) {
36472      composeReference("source", element.getSource());
36473    }
36474    if (element.hasCollected()) {
36475      composeType("collected", element.getCollected());
36476    }
36477  }
36478
36479  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name,
36480      BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
36481    if (element != null) {
36482      open(name);
36483      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
36484      close();
36485    }
36486  }
36487
36488  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(
36489      BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
36490    composeBackbone(element);
36491    if (element.hasDescriptionElement()) {
36492      composeStringCore("description", element.getDescriptionElement(), false);
36493      composeStringExtras("description", element.getDescriptionElement(), false);
36494    }
36495    if (element.hasProcedure()) {
36496      composeCodeableConcept("procedure", element.getProcedure());
36497    }
36498    if (element.hasAdditive()) {
36499      composeReference("additive", element.getAdditive());
36500    }
36501    if (element.hasTime()) {
36502      composeType("time", element.getTime());
36503    }
36504  }
36505
36506  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name,
36507      BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
36508    if (element != null) {
36509      open(name);
36510      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
36511      close();
36512    }
36513  }
36514
36515  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(
36516      BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
36517    composeBackbone(element);
36518    if (element.hasDescriptionElement()) {
36519      composeStringCore("description", element.getDescriptionElement(), false);
36520      composeStringExtras("description", element.getDescriptionElement(), false);
36521    }
36522    if (element.hasTime()) {
36523      composeType("time", element.getTime());
36524    }
36525  }
36526
36527  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name,
36528      BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
36529    if (element != null) {
36530      open(name);
36531      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
36532      close();
36533    }
36534  }
36535
36536  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(
36537      BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
36538    composeBackbone(element);
36539    if (element.hasDescriptionElement()) {
36540      composeStringCore("description", element.getDescriptionElement(), false);
36541      composeStringExtras("description", element.getDescriptionElement(), false);
36542    }
36543    if (element.hasTemperatureElement()) {
36544      composeDecimalCore("temperature", element.getTemperatureElement(), false);
36545      composeDecimalExtras("temperature", element.getTemperatureElement(), false);
36546    }
36547    if (element.hasScaleElement()) {
36548      composeEnumerationCore("scale", element.getScaleElement(),
36549          new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
36550      composeEnumerationExtras("scale", element.getScaleElement(),
36551          new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
36552    }
36553    if (element.hasDuration()) {
36554      composePeriod("duration", element.getDuration());
36555    }
36556  }
36557
36558  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
36559    if (element != null) {
36560      prop("resourceType", name);
36561      composeBodyStructureInner(element);
36562    }
36563  }
36564
36565  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
36566    composeDomainResourceElements(element);
36567    if (element.hasIdentifier()) {
36568      openArray("identifier");
36569      for (Identifier e : element.getIdentifier())
36570        composeIdentifier(null, e);
36571      closeArray();
36572    }
36573    ;
36574    if (element.hasActiveElement()) {
36575      composeBooleanCore("active", element.getActiveElement(), false);
36576      composeBooleanExtras("active", element.getActiveElement(), false);
36577    }
36578    if (element.hasMorphology()) {
36579      composeCodeableConcept("morphology", element.getMorphology());
36580    }
36581    if (element.hasLocation()) {
36582      composeCodeableConcept("location", element.getLocation());
36583    }
36584    if (element.hasLocationQualifier()) {
36585      openArray("locationQualifier");
36586      for (CodeableConcept e : element.getLocationQualifier())
36587        composeCodeableConcept(null, e);
36588      closeArray();
36589    }
36590    ;
36591    if (element.hasDescriptionElement()) {
36592      composeStringCore("description", element.getDescriptionElement(), false);
36593      composeStringExtras("description", element.getDescriptionElement(), false);
36594    }
36595    if (element.hasImage()) {
36596      openArray("image");
36597      for (Attachment e : element.getImage())
36598        composeAttachment(null, e);
36599      closeArray();
36600    }
36601    ;
36602    if (element.hasPatient()) {
36603      composeReference("patient", element.getPatient());
36604    }
36605  }
36606
36607  protected void composeBundle(String name, Bundle element) throws IOException {
36608    if (element != null) {
36609      prop("resourceType", name);
36610      composeBundleInner(element);
36611    }
36612  }
36613
36614  protected void composeBundleInner(Bundle element) throws IOException {
36615    composeResourceElements(element);
36616    if (element.hasIdentifier()) {
36617      composeIdentifier("identifier", element.getIdentifier());
36618    }
36619    if (element.hasTypeElement()) {
36620      composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
36621      composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
36622    }
36623    if (element.hasTimestampElement()) {
36624      composeInstantCore("timestamp", element.getTimestampElement(), false);
36625      composeInstantExtras("timestamp", element.getTimestampElement(), false);
36626    }
36627    if (element.hasTotalElement()) {
36628      composeUnsignedIntCore("total", element.getTotalElement(), false);
36629      composeUnsignedIntExtras("total", element.getTotalElement(), false);
36630    }
36631    if (element.hasLink()) {
36632      openArray("link");
36633      for (Bundle.BundleLinkComponent e : element.getLink())
36634        composeBundleBundleLinkComponent(null, e);
36635      closeArray();
36636    }
36637    ;
36638    if (element.hasEntry()) {
36639      openArray("entry");
36640      for (Bundle.BundleEntryComponent e : element.getEntry())
36641        composeBundleBundleEntryComponent(null, e);
36642      closeArray();
36643    }
36644    ;
36645    if (element.hasSignature()) {
36646      composeSignature("signature", element.getSignature());
36647    }
36648  }
36649
36650  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
36651    if (element != null) {
36652      open(name);
36653      composeBundleBundleLinkComponentInner(element);
36654      close();
36655    }
36656  }
36657
36658  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
36659    composeBackbone(element);
36660    if (element.hasRelationElement()) {
36661      composeStringCore("relation", element.getRelationElement(), false);
36662      composeStringExtras("relation", element.getRelationElement(), false);
36663    }
36664    if (element.hasUrlElement()) {
36665      composeUriCore("url", element.getUrlElement(), false);
36666      composeUriExtras("url", element.getUrlElement(), false);
36667    }
36668  }
36669
36670  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element)
36671      throws IOException {
36672    if (element != null) {
36673      open(name);
36674      composeBundleBundleEntryComponentInner(element);
36675      close();
36676    }
36677  }
36678
36679  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
36680    composeBackbone(element);
36681    if (element.hasLink()) {
36682      openArray("link");
36683      for (Bundle.BundleLinkComponent e : element.getLink())
36684        composeBundleBundleLinkComponent(null, e);
36685      closeArray();
36686    }
36687    ;
36688    if (element.hasFullUrlElement()) {
36689      composeUriCore("fullUrl", element.getFullUrlElement(), false);
36690      composeUriExtras("fullUrl", element.getFullUrlElement(), false);
36691    }
36692    if (element.hasResource()) {
36693      open("resource");
36694      composeResource(element.getResource());
36695      close();
36696    }
36697    if (element.hasSearch()) {
36698      composeBundleBundleEntrySearchComponent("search", element.getSearch());
36699    }
36700    if (element.hasRequest()) {
36701      composeBundleBundleEntryRequestComponent("request", element.getRequest());
36702    }
36703    if (element.hasResponse()) {
36704      composeBundleBundleEntryResponseComponent("response", element.getResponse());
36705    }
36706  }
36707
36708  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element)
36709      throws IOException {
36710    if (element != null) {
36711      open(name);
36712      composeBundleBundleEntrySearchComponentInner(element);
36713      close();
36714    }
36715  }
36716
36717  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element)
36718      throws IOException {
36719    composeBackbone(element);
36720    if (element.hasModeElement()) {
36721      composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
36722      composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
36723    }
36724    if (element.hasScoreElement()) {
36725      composeDecimalCore("score", element.getScoreElement(), false);
36726      composeDecimalExtras("score", element.getScoreElement(), false);
36727    }
36728  }
36729
36730  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element)
36731      throws IOException {
36732    if (element != null) {
36733      open(name);
36734      composeBundleBundleEntryRequestComponentInner(element);
36735      close();
36736    }
36737  }
36738
36739  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element)
36740      throws IOException {
36741    composeBackbone(element);
36742    if (element.hasMethodElement()) {
36743      composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
36744      composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
36745    }
36746    if (element.hasUrlElement()) {
36747      composeUriCore("url", element.getUrlElement(), false);
36748      composeUriExtras("url", element.getUrlElement(), false);
36749    }
36750    if (element.hasIfNoneMatchElement()) {
36751      composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
36752      composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
36753    }
36754    if (element.hasIfModifiedSinceElement()) {
36755      composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
36756      composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
36757    }
36758    if (element.hasIfMatchElement()) {
36759      composeStringCore("ifMatch", element.getIfMatchElement(), false);
36760      composeStringExtras("ifMatch", element.getIfMatchElement(), false);
36761    }
36762    if (element.hasIfNoneExistElement()) {
36763      composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
36764      composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
36765    }
36766  }
36767
36768  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element)
36769      throws IOException {
36770    if (element != null) {
36771      open(name);
36772      composeBundleBundleEntryResponseComponentInner(element);
36773      close();
36774    }
36775  }
36776
36777  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element)
36778      throws IOException {
36779    composeBackbone(element);
36780    if (element.hasStatusElement()) {
36781      composeStringCore("status", element.getStatusElement(), false);
36782      composeStringExtras("status", element.getStatusElement(), false);
36783    }
36784    if (element.hasLocationElement()) {
36785      composeUriCore("location", element.getLocationElement(), false);
36786      composeUriExtras("location", element.getLocationElement(), false);
36787    }
36788    if (element.hasEtagElement()) {
36789      composeStringCore("etag", element.getEtagElement(), false);
36790      composeStringExtras("etag", element.getEtagElement(), false);
36791    }
36792    if (element.hasLastModifiedElement()) {
36793      composeInstantCore("lastModified", element.getLastModifiedElement(), false);
36794      composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
36795    }
36796    if (element.hasOutcome()) {
36797      open("outcome");
36798      composeResource(element.getOutcome());
36799      close();
36800    }
36801  }
36802
36803  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
36804    if (element != null) {
36805      prop("resourceType", name);
36806      composeCapabilityStatementInner(element);
36807    }
36808  }
36809
36810  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
36811    composeDomainResourceElements(element);
36812    if (element.hasUrlElement()) {
36813      composeUriCore("url", element.getUrlElement(), false);
36814      composeUriExtras("url", element.getUrlElement(), false);
36815    }
36816    if (element.hasVersionElement()) {
36817      composeStringCore("version", element.getVersionElement(), false);
36818      composeStringExtras("version", element.getVersionElement(), false);
36819    }
36820    if (element.hasNameElement()) {
36821      composeStringCore("name", element.getNameElement(), false);
36822      composeStringExtras("name", element.getNameElement(), false);
36823    }
36824    if (element.hasTitleElement()) {
36825      composeStringCore("title", element.getTitleElement(), false);
36826      composeStringExtras("title", element.getTitleElement(), false);
36827    }
36828    if (element.hasStatusElement()) {
36829      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
36830          false);
36831      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
36832          false);
36833    }
36834    if (element.hasExperimentalElement()) {
36835      composeBooleanCore("experimental", element.getExperimentalElement(), false);
36836      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
36837    }
36838    if (element.hasDateElement()) {
36839      composeDateTimeCore("date", element.getDateElement(), false);
36840      composeDateTimeExtras("date", element.getDateElement(), false);
36841    }
36842    if (element.hasPublisherElement()) {
36843      composeStringCore("publisher", element.getPublisherElement(), false);
36844      composeStringExtras("publisher", element.getPublisherElement(), false);
36845    }
36846    if (element.hasContact()) {
36847      openArray("contact");
36848      for (ContactDetail e : element.getContact())
36849        composeContactDetail(null, e);
36850      closeArray();
36851    }
36852    ;
36853    if (element.hasDescriptionElement()) {
36854      composeMarkdownCore("description", element.getDescriptionElement(), false);
36855      composeMarkdownExtras("description", element.getDescriptionElement(), false);
36856    }
36857    if (element.hasUseContext()) {
36858      openArray("useContext");
36859      for (UsageContext e : element.getUseContext())
36860        composeUsageContext(null, e);
36861      closeArray();
36862    }
36863    ;
36864    if (element.hasJurisdiction()) {
36865      openArray("jurisdiction");
36866      for (CodeableConcept e : element.getJurisdiction())
36867        composeCodeableConcept(null, e);
36868      closeArray();
36869    }
36870    ;
36871    if (element.hasPurposeElement()) {
36872      composeMarkdownCore("purpose", element.getPurposeElement(), false);
36873      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
36874    }
36875    if (element.hasCopyrightElement()) {
36876      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36877      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36878    }
36879    if (element.hasKindElement()) {
36880      composeEnumerationCore("kind", element.getKindElement(),
36881          new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
36882      composeEnumerationExtras("kind", element.getKindElement(),
36883          new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
36884    }
36885    if (element.hasInstantiates()) {
36886      openArray("instantiates");
36887      for (CanonicalType e : element.getInstantiates())
36888        composeCanonicalCore(null, e, true);
36889      closeArray();
36890      if (anyHasExtras(element.getInstantiates())) {
36891        openArray("_instantiates");
36892        for (CanonicalType e : element.getInstantiates())
36893          composeCanonicalExtras(null, e, true);
36894        closeArray();
36895      }
36896    }
36897    ;
36898    if (element.hasImports()) {
36899      openArray("imports");
36900      for (CanonicalType e : element.getImports())
36901        composeCanonicalCore(null, e, true);
36902      closeArray();
36903      if (anyHasExtras(element.getImports())) {
36904        openArray("_imports");
36905        for (CanonicalType e : element.getImports())
36906          composeCanonicalExtras(null, e, true);
36907        closeArray();
36908      }
36909    }
36910    ;
36911    if (element.hasSoftware()) {
36912      composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
36913    }
36914    if (element.hasImplementation()) {
36915      composeCapabilityStatementCapabilityStatementImplementationComponent("implementation",
36916          element.getImplementation());
36917    }
36918    if (element.hasFhirVersionElement()) {
36919      composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(),
36920          false);
36921      composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(),
36922          new Enumerations.FHIRVersionEnumFactory(), false);
36923    }
36924    if (element.hasFormat()) {
36925      openArray("format");
36926      for (CodeType e : element.getFormat())
36927        composeCodeCore(null, e, true);
36928      closeArray();
36929      if (anyHasExtras(element.getFormat())) {
36930        openArray("_format");
36931        for (CodeType e : element.getFormat())
36932          composeCodeExtras(null, e, true);
36933        closeArray();
36934      }
36935    }
36936    ;
36937    if (element.hasPatchFormat()) {
36938      openArray("patchFormat");
36939      for (CodeType e : element.getPatchFormat())
36940        composeCodeCore(null, e, true);
36941      closeArray();
36942      if (anyHasExtras(element.getPatchFormat())) {
36943        openArray("_patchFormat");
36944        for (CodeType e : element.getPatchFormat())
36945          composeCodeExtras(null, e, true);
36946        closeArray();
36947      }
36948    }
36949    ;
36950    if (element.hasImplementationGuide()) {
36951      openArray("implementationGuide");
36952      for (CanonicalType e : element.getImplementationGuide())
36953        composeCanonicalCore(null, e, true);
36954      closeArray();
36955      if (anyHasExtras(element.getImplementationGuide())) {
36956        openArray("_implementationGuide");
36957        for (CanonicalType e : element.getImplementationGuide())
36958          composeCanonicalExtras(null, e, true);
36959        closeArray();
36960      }
36961    }
36962    ;
36963    if (element.hasRest()) {
36964      openArray("rest");
36965      for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest())
36966        composeCapabilityStatementCapabilityStatementRestComponent(null, e);
36967      closeArray();
36968    }
36969    ;
36970    if (element.hasMessaging()) {
36971      openArray("messaging");
36972      for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging())
36973        composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
36974      closeArray();
36975    }
36976    ;
36977    if (element.hasDocument()) {
36978      openArray("document");
36979      for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument())
36980        composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
36981      closeArray();
36982    }
36983    ;
36984  }
36985
36986  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name,
36987      CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
36988    if (element != null) {
36989      open(name);
36990      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
36991      close();
36992    }
36993  }
36994
36995  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(
36996      CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
36997    composeBackbone(element);
36998    if (element.hasNameElement()) {
36999      composeStringCore("name", element.getNameElement(), false);
37000      composeStringExtras("name", element.getNameElement(), false);
37001    }
37002    if (element.hasVersionElement()) {
37003      composeStringCore("version", element.getVersionElement(), false);
37004      composeStringExtras("version", element.getVersionElement(), false);
37005    }
37006    if (element.hasReleaseDateElement()) {
37007      composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
37008      composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
37009    }
37010  }
37011
37012  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name,
37013      CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
37014    if (element != null) {
37015      open(name);
37016      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
37017      close();
37018    }
37019  }
37020
37021  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(
37022      CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
37023    composeBackbone(element);
37024    if (element.hasDescriptionElement()) {
37025      composeStringCore("description", element.getDescriptionElement(), false);
37026      composeStringExtras("description", element.getDescriptionElement(), false);
37027    }
37028    if (element.hasUrlElement()) {
37029      composeUrlCore("url", element.getUrlElement(), false);
37030      composeUrlExtras("url", element.getUrlElement(), false);
37031    }
37032    if (element.hasCustodian()) {
37033      composeReference("custodian", element.getCustodian());
37034    }
37035  }
37036
37037  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name,
37038      CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
37039    if (element != null) {
37040      open(name);
37041      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
37042      close();
37043    }
37044  }
37045
37046  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(
37047      CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
37048    composeBackbone(element);
37049    if (element.hasModeElement()) {
37050      composeEnumerationCore("mode", element.getModeElement(),
37051          new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
37052      composeEnumerationExtras("mode", element.getModeElement(),
37053          new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
37054    }
37055    if (element.hasDocumentationElement()) {
37056      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37057      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37058    }
37059    if (element.hasSecurity()) {
37060      composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
37061    }
37062    if (element.hasResource()) {
37063      openArray("resource");
37064      for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource())
37065        composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
37066      closeArray();
37067    }
37068    ;
37069    if (element.hasInteraction()) {
37070      openArray("interaction");
37071      for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction())
37072        composeCapabilityStatementSystemInteractionComponent(null, e);
37073      closeArray();
37074    }
37075    ;
37076    if (element.hasSearchParam()) {
37077      openArray("searchParam");
37078      for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam())
37079        composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
37080      closeArray();
37081    }
37082    ;
37083    if (element.hasOperation()) {
37084      openArray("operation");
37085      for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation())
37086        composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
37087      closeArray();
37088    }
37089    ;
37090    if (element.hasCompartment()) {
37091      openArray("compartment");
37092      for (CanonicalType e : element.getCompartment())
37093        composeCanonicalCore(null, e, true);
37094      closeArray();
37095      if (anyHasExtras(element.getCompartment())) {
37096        openArray("_compartment");
37097        for (CanonicalType e : element.getCompartment())
37098          composeCanonicalExtras(null, e, true);
37099        closeArray();
37100      }
37101    }
37102    ;
37103  }
37104
37105  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name,
37106      CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
37107    if (element != null) {
37108      open(name);
37109      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
37110      close();
37111    }
37112  }
37113
37114  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(
37115      CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
37116    composeBackbone(element);
37117    if (element.hasCorsElement()) {
37118      composeBooleanCore("cors", element.getCorsElement(), false);
37119      composeBooleanExtras("cors", element.getCorsElement(), false);
37120    }
37121    if (element.hasService()) {
37122      openArray("service");
37123      for (CodeableConcept e : element.getService())
37124        composeCodeableConcept(null, e);
37125      closeArray();
37126    }
37127    ;
37128    if (element.hasDescriptionElement()) {
37129      composeMarkdownCore("description", element.getDescriptionElement(), false);
37130      composeMarkdownExtras("description", element.getDescriptionElement(), false);
37131    }
37132  }
37133
37134  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name,
37135      CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
37136    if (element != null) {
37137      open(name);
37138      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
37139      close();
37140    }
37141  }
37142
37143  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(
37144      CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
37145    composeBackbone(element);
37146    if (element.hasTypeElement()) {
37147      composeCodeCore("type", element.getTypeElement(), false);
37148      composeCodeExtras("type", element.getTypeElement(), false);
37149    }
37150    if (element.hasProfileElement()) {
37151      composeCanonicalCore("profile", element.getProfileElement(), false);
37152      composeCanonicalExtras("profile", element.getProfileElement(), false);
37153    }
37154    if (element.hasSupportedProfile()) {
37155      openArray("supportedProfile");
37156      for (CanonicalType e : element.getSupportedProfile())
37157        composeCanonicalCore(null, e, true);
37158      closeArray();
37159      if (anyHasExtras(element.getSupportedProfile())) {
37160        openArray("_supportedProfile");
37161        for (CanonicalType e : element.getSupportedProfile())
37162          composeCanonicalExtras(null, e, true);
37163        closeArray();
37164      }
37165    }
37166    ;
37167    if (element.hasDocumentationElement()) {
37168      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37169      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37170    }
37171    if (element.hasInteraction()) {
37172      openArray("interaction");
37173      for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction())
37174        composeCapabilityStatementResourceInteractionComponent(null, e);
37175      closeArray();
37176    }
37177    ;
37178    if (element.hasVersioningElement()) {
37179      composeEnumerationCore("versioning", element.getVersioningElement(),
37180          new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
37181      composeEnumerationExtras("versioning", element.getVersioningElement(),
37182          new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
37183    }
37184    if (element.hasReadHistoryElement()) {
37185      composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
37186      composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
37187    }
37188    if (element.hasUpdateCreateElement()) {
37189      composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
37190      composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
37191    }
37192    if (element.hasConditionalCreateElement()) {
37193      composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
37194      composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
37195    }
37196    if (element.hasConditionalReadElement()) {
37197      composeEnumerationCore("conditionalRead", element.getConditionalReadElement(),
37198          new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
37199      composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(),
37200          new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
37201    }
37202    if (element.hasConditionalUpdateElement()) {
37203      composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
37204      composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
37205    }
37206    if (element.hasConditionalDeleteElement()) {
37207      composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(),
37208          new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
37209      composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(),
37210          new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
37211    }
37212    if (element.hasReferencePolicy()) {
37213      openArray("referencePolicy");
37214      for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy())
37215        composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
37216      closeArray();
37217      if (anyHasExtras(element.getReferencePolicy())) {
37218        openArray("_referencePolicy");
37219        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy())
37220          composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
37221        closeArray();
37222      }
37223    }
37224    ;
37225    if (element.hasSearchInclude()) {
37226      openArray("searchInclude");
37227      for (StringType e : element.getSearchInclude())
37228        composeStringCore(null, e, true);
37229      closeArray();
37230      if (anyHasExtras(element.getSearchInclude())) {
37231        openArray("_searchInclude");
37232        for (StringType e : element.getSearchInclude())
37233          composeStringExtras(null, e, true);
37234        closeArray();
37235      }
37236    }
37237    ;
37238    if (element.hasSearchRevInclude()) {
37239      openArray("searchRevInclude");
37240      for (StringType e : element.getSearchRevInclude())
37241        composeStringCore(null, e, true);
37242      closeArray();
37243      if (anyHasExtras(element.getSearchRevInclude())) {
37244        openArray("_searchRevInclude");
37245        for (StringType e : element.getSearchRevInclude())
37246          composeStringExtras(null, e, true);
37247        closeArray();
37248      }
37249    }
37250    ;
37251    if (element.hasSearchParam()) {
37252      openArray("searchParam");
37253      for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam())
37254        composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
37255      closeArray();
37256    }
37257    ;
37258    if (element.hasOperation()) {
37259      openArray("operation");
37260      for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation())
37261        composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
37262      closeArray();
37263    }
37264    ;
37265  }
37266
37267  protected void composeCapabilityStatementResourceInteractionComponent(String name,
37268      CapabilityStatement.ResourceInteractionComponent element) throws IOException {
37269    if (element != null) {
37270      open(name);
37271      composeCapabilityStatementResourceInteractionComponentInner(element);
37272      close();
37273    }
37274  }
37275
37276  protected void composeCapabilityStatementResourceInteractionComponentInner(
37277      CapabilityStatement.ResourceInteractionComponent element) throws IOException {
37278    composeBackbone(element);
37279    if (element.hasCodeElement()) {
37280      composeEnumerationCore("code", element.getCodeElement(),
37281          new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
37282      composeEnumerationExtras("code", element.getCodeElement(),
37283          new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
37284    }
37285    if (element.hasDocumentationElement()) {
37286      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37287      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37288    }
37289  }
37290
37291  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name,
37292      CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
37293    if (element != null) {
37294      open(name);
37295      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
37296      close();
37297    }
37298  }
37299
37300  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(
37301      CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
37302    composeBackbone(element);
37303    if (element.hasNameElement()) {
37304      composeStringCore("name", element.getNameElement(), false);
37305      composeStringExtras("name", element.getNameElement(), false);
37306    }
37307    if (element.hasDefinitionElement()) {
37308      composeCanonicalCore("definition", element.getDefinitionElement(), false);
37309      composeCanonicalExtras("definition", element.getDefinitionElement(), false);
37310    }
37311    if (element.hasTypeElement()) {
37312      composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
37313      composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
37314    }
37315    if (element.hasDocumentationElement()) {
37316      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37317      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37318    }
37319  }
37320
37321  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name,
37322      CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
37323    if (element != null) {
37324      open(name);
37325      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
37326      close();
37327    }
37328  }
37329
37330  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(
37331      CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
37332    composeBackbone(element);
37333    if (element.hasNameElement()) {
37334      composeStringCore("name", element.getNameElement(), false);
37335      composeStringExtras("name", element.getNameElement(), false);
37336    }
37337    if (element.hasDefinitionElement()) {
37338      composeCanonicalCore("definition", element.getDefinitionElement(), false);
37339      composeCanonicalExtras("definition", element.getDefinitionElement(), false);
37340    }
37341    if (element.hasDocumentationElement()) {
37342      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37343      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37344    }
37345  }
37346
37347  protected void composeCapabilityStatementSystemInteractionComponent(String name,
37348      CapabilityStatement.SystemInteractionComponent element) throws IOException {
37349    if (element != null) {
37350      open(name);
37351      composeCapabilityStatementSystemInteractionComponentInner(element);
37352      close();
37353    }
37354  }
37355
37356  protected void composeCapabilityStatementSystemInteractionComponentInner(
37357      CapabilityStatement.SystemInteractionComponent element) throws IOException {
37358    composeBackbone(element);
37359    if (element.hasCodeElement()) {
37360      composeEnumerationCore("code", element.getCodeElement(),
37361          new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
37362      composeEnumerationExtras("code", element.getCodeElement(),
37363          new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
37364    }
37365    if (element.hasDocumentationElement()) {
37366      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37367      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37368    }
37369  }
37370
37371  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name,
37372      CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
37373    if (element != null) {
37374      open(name);
37375      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
37376      close();
37377    }
37378  }
37379
37380  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(
37381      CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
37382    composeBackbone(element);
37383    if (element.hasEndpoint()) {
37384      openArray("endpoint");
37385      for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint())
37386        composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
37387      closeArray();
37388    }
37389    ;
37390    if (element.hasReliableCacheElement()) {
37391      composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
37392      composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
37393    }
37394    if (element.hasDocumentationElement()) {
37395      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37396      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37397    }
37398    if (element.hasSupportedMessage()) {
37399      openArray("supportedMessage");
37400      for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage())
37401        composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
37402      closeArray();
37403    }
37404    ;
37405  }
37406
37407  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name,
37408      CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
37409    if (element != null) {
37410      open(name);
37411      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
37412      close();
37413    }
37414  }
37415
37416  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(
37417      CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
37418    composeBackbone(element);
37419    if (element.hasProtocol()) {
37420      composeCoding("protocol", element.getProtocol());
37421    }
37422    if (element.hasAddressElement()) {
37423      composeUrlCore("address", element.getAddressElement(), false);
37424      composeUrlExtras("address", element.getAddressElement(), false);
37425    }
37426  }
37427
37428  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name,
37429      CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
37430    if (element != null) {
37431      open(name);
37432      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
37433      close();
37434    }
37435  }
37436
37437  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(
37438      CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
37439    composeBackbone(element);
37440    if (element.hasModeElement()) {
37441      composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(),
37442          false);
37443      composeEnumerationExtras("mode", element.getModeElement(),
37444          new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
37445    }
37446    if (element.hasDefinitionElement()) {
37447      composeCanonicalCore("definition", element.getDefinitionElement(), false);
37448      composeCanonicalExtras("definition", element.getDefinitionElement(), false);
37449    }
37450  }
37451
37452  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name,
37453      CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
37454    if (element != null) {
37455      open(name);
37456      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
37457      close();
37458    }
37459  }
37460
37461  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(
37462      CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
37463    composeBackbone(element);
37464    if (element.hasModeElement()) {
37465      composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(),
37466          false);
37467      composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(),
37468          false);
37469    }
37470    if (element.hasDocumentationElement()) {
37471      composeMarkdownCore("documentation", element.getDocumentationElement(), false);
37472      composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
37473    }
37474    if (element.hasProfileElement()) {
37475      composeCanonicalCore("profile", element.getProfileElement(), false);
37476      composeCanonicalExtras("profile", element.getProfileElement(), false);
37477    }
37478  }
37479
37480  protected void composeCarePlan(String name, CarePlan element) throws IOException {
37481    if (element != null) {
37482      prop("resourceType", name);
37483      composeCarePlanInner(element);
37484    }
37485  }
37486
37487  protected void composeCarePlanInner(CarePlan element) throws IOException {
37488    composeDomainResourceElements(element);
37489    if (element.hasIdentifier()) {
37490      openArray("identifier");
37491      for (Identifier e : element.getIdentifier())
37492        composeIdentifier(null, e);
37493      closeArray();
37494    }
37495    ;
37496    if (element.hasInstantiatesCanonical()) {
37497      openArray("instantiatesCanonical");
37498      for (CanonicalType e : element.getInstantiatesCanonical())
37499        composeCanonicalCore(null, e, true);
37500      closeArray();
37501      if (anyHasExtras(element.getInstantiatesCanonical())) {
37502        openArray("_instantiatesCanonical");
37503        for (CanonicalType e : element.getInstantiatesCanonical())
37504          composeCanonicalExtras(null, e, true);
37505        closeArray();
37506      }
37507    }
37508    ;
37509    if (element.hasInstantiatesUri()) {
37510      openArray("instantiatesUri");
37511      for (UriType e : element.getInstantiatesUri())
37512        composeUriCore(null, e, true);
37513      closeArray();
37514      if (anyHasExtras(element.getInstantiatesUri())) {
37515        openArray("_instantiatesUri");
37516        for (UriType e : element.getInstantiatesUri())
37517          composeUriExtras(null, e, true);
37518        closeArray();
37519      }
37520    }
37521    ;
37522    if (element.hasBasedOn()) {
37523      openArray("basedOn");
37524      for (Reference e : element.getBasedOn())
37525        composeReference(null, e);
37526      closeArray();
37527    }
37528    ;
37529    if (element.hasReplaces()) {
37530      openArray("replaces");
37531      for (Reference e : element.getReplaces())
37532        composeReference(null, e);
37533      closeArray();
37534    }
37535    ;
37536    if (element.hasPartOf()) {
37537      openArray("partOf");
37538      for (Reference e : element.getPartOf())
37539        composeReference(null, e);
37540      closeArray();
37541    }
37542    ;
37543    if (element.hasStatusElement()) {
37544      composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
37545      composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
37546    }
37547    if (element.hasIntentElement()) {
37548      composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
37549      composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
37550    }
37551    if (element.hasCategory()) {
37552      openArray("category");
37553      for (CodeableConcept e : element.getCategory())
37554        composeCodeableConcept(null, e);
37555      closeArray();
37556    }
37557    ;
37558    if (element.hasTitleElement()) {
37559      composeStringCore("title", element.getTitleElement(), false);
37560      composeStringExtras("title", element.getTitleElement(), false);
37561    }
37562    if (element.hasDescriptionElement()) {
37563      composeStringCore("description", element.getDescriptionElement(), false);
37564      composeStringExtras("description", element.getDescriptionElement(), false);
37565    }
37566    if (element.hasSubject()) {
37567      composeReference("subject", element.getSubject());
37568    }
37569    if (element.hasEncounter()) {
37570      composeReference("encounter", element.getEncounter());
37571    }
37572    if (element.hasPeriod()) {
37573      composePeriod("period", element.getPeriod());
37574    }
37575    if (element.hasCreatedElement()) {
37576      composeDateTimeCore("created", element.getCreatedElement(), false);
37577      composeDateTimeExtras("created", element.getCreatedElement(), false);
37578    }
37579    if (element.hasAuthor()) {
37580      composeReference("author", element.getAuthor());
37581    }
37582    if (element.hasContributor()) {
37583      openArray("contributor");
37584      for (Reference e : element.getContributor())
37585        composeReference(null, e);
37586      closeArray();
37587    }
37588    ;
37589    if (element.hasCareTeam()) {
37590      openArray("careTeam");
37591      for (Reference e : element.getCareTeam())
37592        composeReference(null, e);
37593      closeArray();
37594    }
37595    ;
37596    if (element.hasAddresses()) {
37597      openArray("addresses");
37598      for (Reference e : element.getAddresses())
37599        composeReference(null, e);
37600      closeArray();
37601    }
37602    ;
37603    if (element.hasSupportingInfo()) {
37604      openArray("supportingInfo");
37605      for (Reference e : element.getSupportingInfo())
37606        composeReference(null, e);
37607      closeArray();
37608    }
37609    ;
37610    if (element.hasGoal()) {
37611      openArray("goal");
37612      for (Reference e : element.getGoal())
37613        composeReference(null, e);
37614      closeArray();
37615    }
37616    ;
37617    if (element.hasActivity()) {
37618      openArray("activity");
37619      for (CarePlan.CarePlanActivityComponent e : element.getActivity())
37620        composeCarePlanCarePlanActivityComponent(null, e);
37621      closeArray();
37622    }
37623    ;
37624    if (element.hasNote()) {
37625      openArray("note");
37626      for (Annotation e : element.getNote())
37627        composeAnnotation(null, e);
37628      closeArray();
37629    }
37630    ;
37631  }
37632
37633  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element)
37634      throws IOException {
37635    if (element != null) {
37636      open(name);
37637      composeCarePlanCarePlanActivityComponentInner(element);
37638      close();
37639    }
37640  }
37641
37642  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element)
37643      throws IOException {
37644    composeBackbone(element);
37645    if (element.hasOutcomeCodeableConcept()) {
37646      openArray("outcomeCodeableConcept");
37647      for (CodeableConcept e : element.getOutcomeCodeableConcept())
37648        composeCodeableConcept(null, e);
37649      closeArray();
37650    }
37651    ;
37652    if (element.hasOutcomeReference()) {
37653      openArray("outcomeReference");
37654      for (Reference e : element.getOutcomeReference())
37655        composeReference(null, e);
37656      closeArray();
37657    }
37658    ;
37659    if (element.hasProgress()) {
37660      openArray("progress");
37661      for (Annotation e : element.getProgress())
37662        composeAnnotation(null, e);
37663      closeArray();
37664    }
37665    ;
37666    if (element.hasReference()) {
37667      composeReference("reference", element.getReference());
37668    }
37669    if (element.hasDetail()) {
37670      composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
37671    }
37672  }
37673
37674  protected void composeCarePlanCarePlanActivityDetailComponent(String name,
37675      CarePlan.CarePlanActivityDetailComponent element) throws IOException {
37676    if (element != null) {
37677      open(name);
37678      composeCarePlanCarePlanActivityDetailComponentInner(element);
37679      close();
37680    }
37681  }
37682
37683  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element)
37684      throws IOException {
37685    composeBackbone(element);
37686    if (element.hasKindElement()) {
37687      composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
37688      composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
37689    }
37690    if (element.hasInstantiatesCanonical()) {
37691      openArray("instantiatesCanonical");
37692      for (CanonicalType e : element.getInstantiatesCanonical())
37693        composeCanonicalCore(null, e, true);
37694      closeArray();
37695      if (anyHasExtras(element.getInstantiatesCanonical())) {
37696        openArray("_instantiatesCanonical");
37697        for (CanonicalType e : element.getInstantiatesCanonical())
37698          composeCanonicalExtras(null, e, true);
37699        closeArray();
37700      }
37701    }
37702    ;
37703    if (element.hasInstantiatesUri()) {
37704      openArray("instantiatesUri");
37705      for (UriType e : element.getInstantiatesUri())
37706        composeUriCore(null, e, true);
37707      closeArray();
37708      if (anyHasExtras(element.getInstantiatesUri())) {
37709        openArray("_instantiatesUri");
37710        for (UriType e : element.getInstantiatesUri())
37711          composeUriExtras(null, e, true);
37712        closeArray();
37713      }
37714    }
37715    ;
37716    if (element.hasCode()) {
37717      composeCodeableConcept("code", element.getCode());
37718    }
37719    if (element.hasReasonCode()) {
37720      openArray("reasonCode");
37721      for (CodeableConcept e : element.getReasonCode())
37722        composeCodeableConcept(null, e);
37723      closeArray();
37724    }
37725    ;
37726    if (element.hasReasonReference()) {
37727      openArray("reasonReference");
37728      for (Reference e : element.getReasonReference())
37729        composeReference(null, e);
37730      closeArray();
37731    }
37732    ;
37733    if (element.hasGoal()) {
37734      openArray("goal");
37735      for (Reference e : element.getGoal())
37736        composeReference(null, e);
37737      closeArray();
37738    }
37739    ;
37740    if (element.hasStatusElement()) {
37741      composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(),
37742          false);
37743      composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(),
37744          false);
37745    }
37746    if (element.hasStatusReason()) {
37747      composeCodeableConcept("statusReason", element.getStatusReason());
37748    }
37749    if (element.hasDoNotPerformElement()) {
37750      composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
37751      composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
37752    }
37753    if (element.hasScheduled()) {
37754      composeType("scheduled", element.getScheduled());
37755    }
37756    if (element.hasLocation()) {
37757      composeReference("location", element.getLocation());
37758    }
37759    if (element.hasPerformer()) {
37760      openArray("performer");
37761      for (Reference e : element.getPerformer())
37762        composeReference(null, e);
37763      closeArray();
37764    }
37765    ;
37766    if (element.hasProduct()) {
37767      composeType("product", element.getProduct());
37768    }
37769    if (element.hasDailyAmount()) {
37770      composeQuantity("dailyAmount", element.getDailyAmount());
37771    }
37772    if (element.hasQuantity()) {
37773      composeQuantity("quantity", element.getQuantity());
37774    }
37775    if (element.hasDescriptionElement()) {
37776      composeStringCore("description", element.getDescriptionElement(), false);
37777      composeStringExtras("description", element.getDescriptionElement(), false);
37778    }
37779  }
37780
37781  protected void composeCareTeam(String name, CareTeam element) throws IOException {
37782    if (element != null) {
37783      prop("resourceType", name);
37784      composeCareTeamInner(element);
37785    }
37786  }
37787
37788  protected void composeCareTeamInner(CareTeam element) throws IOException {
37789    composeDomainResourceElements(element);
37790    if (element.hasIdentifier()) {
37791      openArray("identifier");
37792      for (Identifier e : element.getIdentifier())
37793        composeIdentifier(null, e);
37794      closeArray();
37795    }
37796    ;
37797    if (element.hasStatusElement()) {
37798      composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
37799      composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
37800    }
37801    if (element.hasCategory()) {
37802      openArray("category");
37803      for (CodeableConcept e : element.getCategory())
37804        composeCodeableConcept(null, e);
37805      closeArray();
37806    }
37807    ;
37808    if (element.hasNameElement()) {
37809      composeStringCore("name", element.getNameElement(), false);
37810      composeStringExtras("name", element.getNameElement(), false);
37811    }
37812    if (element.hasSubject()) {
37813      composeReference("subject", element.getSubject());
37814    }
37815    if (element.hasEncounter()) {
37816      composeReference("encounter", element.getEncounter());
37817    }
37818    if (element.hasPeriod()) {
37819      composePeriod("period", element.getPeriod());
37820    }
37821    if (element.hasParticipant()) {
37822      openArray("participant");
37823      for (CareTeam.CareTeamParticipantComponent e : element.getParticipant())
37824        composeCareTeamCareTeamParticipantComponent(null, e);
37825      closeArray();
37826    }
37827    ;
37828    if (element.hasReasonCode()) {
37829      openArray("reasonCode");
37830      for (CodeableConcept e : element.getReasonCode())
37831        composeCodeableConcept(null, e);
37832      closeArray();
37833    }
37834    ;
37835    if (element.hasReasonReference()) {
37836      openArray("reasonReference");
37837      for (Reference e : element.getReasonReference())
37838        composeReference(null, e);
37839      closeArray();
37840    }
37841    ;
37842    if (element.hasManagingOrganization()) {
37843      openArray("managingOrganization");
37844      for (Reference e : element.getManagingOrganization())
37845        composeReference(null, e);
37846      closeArray();
37847    }
37848    ;
37849    if (element.hasTelecom()) {
37850      openArray("telecom");
37851      for (ContactPoint e : element.getTelecom())
37852        composeContactPoint(null, e);
37853      closeArray();
37854    }
37855    ;
37856    if (element.hasNote()) {
37857      openArray("note");
37858      for (Annotation e : element.getNote())
37859        composeAnnotation(null, e);
37860      closeArray();
37861    }
37862    ;
37863  }
37864
37865  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element)
37866      throws IOException {
37867    if (element != null) {
37868      open(name);
37869      composeCareTeamCareTeamParticipantComponentInner(element);
37870      close();
37871    }
37872  }
37873
37874  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element)
37875      throws IOException {
37876    composeBackbone(element);
37877    if (element.hasRole()) {
37878      openArray("role");
37879      for (CodeableConcept e : element.getRole())
37880        composeCodeableConcept(null, e);
37881      closeArray();
37882    }
37883    ;
37884    if (element.hasMember()) {
37885      composeReference("member", element.getMember());
37886    }
37887    if (element.hasOnBehalfOf()) {
37888      composeReference("onBehalfOf", element.getOnBehalfOf());
37889    }
37890    if (element.hasPeriod()) {
37891      composePeriod("period", element.getPeriod());
37892    }
37893  }
37894
37895  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
37896    if (element != null) {
37897      prop("resourceType", name);
37898      composeCatalogEntryInner(element);
37899    }
37900  }
37901
37902  protected void composeCatalogEntryInner(CatalogEntry element) throws IOException {
37903    composeDomainResourceElements(element);
37904    if (element.hasIdentifier()) {
37905      openArray("identifier");
37906      for (Identifier e : element.getIdentifier())
37907        composeIdentifier(null, e);
37908      closeArray();
37909    }
37910    ;
37911    if (element.hasType()) {
37912      composeCodeableConcept("type", element.getType());
37913    }
37914    if (element.hasOrderableElement()) {
37915      composeBooleanCore("orderable", element.getOrderableElement(), false);
37916      composeBooleanExtras("orderable", element.getOrderableElement(), false);
37917    }
37918    if (element.hasReferencedItem()) {
37919      composeReference("referencedItem", element.getReferencedItem());
37920    }
37921    if (element.hasAdditionalIdentifier()) {
37922      openArray("additionalIdentifier");
37923      for (Identifier e : element.getAdditionalIdentifier())
37924        composeIdentifier(null, e);
37925      closeArray();
37926    }
37927    ;
37928    if (element.hasClassification()) {
37929      openArray("classification");
37930      for (CodeableConcept e : element.getClassification())
37931        composeCodeableConcept(null, e);
37932      closeArray();
37933    }
37934    ;
37935    if (element.hasStatusElement()) {
37936      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
37937          false);
37938      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
37939          false);
37940    }
37941    if (element.hasValidityPeriod()) {
37942      composePeriod("validityPeriod", element.getValidityPeriod());
37943    }
37944    if (element.hasValidToElement()) {
37945      composeDateTimeCore("validTo", element.getValidToElement(), false);
37946      composeDateTimeExtras("validTo", element.getValidToElement(), false);
37947    }
37948    if (element.hasLastUpdatedElement()) {
37949      composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
37950      composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
37951    }
37952    if (element.hasAdditionalCharacteristic()) {
37953      openArray("additionalCharacteristic");
37954      for (CodeableConcept e : element.getAdditionalCharacteristic())
37955        composeCodeableConcept(null, e);
37956      closeArray();
37957    }
37958    ;
37959    if (element.hasAdditionalClassification()) {
37960      openArray("additionalClassification");
37961      for (CodeableConcept e : element.getAdditionalClassification())
37962        composeCodeableConcept(null, e);
37963      closeArray();
37964    }
37965    ;
37966    if (element.hasRelatedEntry()) {
37967      openArray("relatedEntry");
37968      for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry())
37969        composeCatalogEntryCatalogEntryRelatedEntryComponent(null, e);
37970      closeArray();
37971    }
37972    ;
37973  }
37974
37975  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name,
37976      CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
37977    if (element != null) {
37978      open(name);
37979      composeCatalogEntryCatalogEntryRelatedEntryComponentInner(element);
37980      close();
37981    }
37982  }
37983
37984  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentInner(
37985      CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
37986    composeBackbone(element);
37987    if (element.hasRelationtypeElement()) {
37988      composeEnumerationCore("relationtype", element.getRelationtypeElement(),
37989          new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
37990      composeEnumerationExtras("relationtype", element.getRelationtypeElement(),
37991          new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
37992    }
37993    if (element.hasItem()) {
37994      composeReference("item", element.getItem());
37995    }
37996  }
37997
37998  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
37999    if (element != null) {
38000      prop("resourceType", name);
38001      composeChargeItemInner(element);
38002    }
38003  }
38004
38005  protected void composeChargeItemInner(ChargeItem element) throws IOException {
38006    composeDomainResourceElements(element);
38007    if (element.hasIdentifier()) {
38008      openArray("identifier");
38009      for (Identifier e : element.getIdentifier())
38010        composeIdentifier(null, e);
38011      closeArray();
38012    }
38013    ;
38014    if (element.hasDefinitionUri()) {
38015      openArray("definitionUri");
38016      for (UriType e : element.getDefinitionUri())
38017        composeUriCore(null, e, true);
38018      closeArray();
38019      if (anyHasExtras(element.getDefinitionUri())) {
38020        openArray("_definitionUri");
38021        for (UriType e : element.getDefinitionUri())
38022          composeUriExtras(null, e, true);
38023        closeArray();
38024      }
38025    }
38026    ;
38027    if (element.hasDefinitionCanonical()) {
38028      openArray("definitionCanonical");
38029      for (CanonicalType e : element.getDefinitionCanonical())
38030        composeCanonicalCore(null, e, true);
38031      closeArray();
38032      if (anyHasExtras(element.getDefinitionCanonical())) {
38033        openArray("_definitionCanonical");
38034        for (CanonicalType e : element.getDefinitionCanonical())
38035          composeCanonicalExtras(null, e, true);
38036        closeArray();
38037      }
38038    }
38039    ;
38040    if (element.hasStatusElement()) {
38041      composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
38042      composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(),
38043          false);
38044    }
38045    if (element.hasPartOf()) {
38046      openArray("partOf");
38047      for (Reference e : element.getPartOf())
38048        composeReference(null, e);
38049      closeArray();
38050    }
38051    ;
38052    if (element.hasCode()) {
38053      composeCodeableConcept("code", element.getCode());
38054    }
38055    if (element.hasSubject()) {
38056      composeReference("subject", element.getSubject());
38057    }
38058    if (element.hasContext()) {
38059      composeReference("context", element.getContext());
38060    }
38061    if (element.hasOccurrence()) {
38062      composeType("occurrence", element.getOccurrence());
38063    }
38064    if (element.hasPerformer()) {
38065      openArray("performer");
38066      for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer())
38067        composeChargeItemChargeItemPerformerComponent(null, e);
38068      closeArray();
38069    }
38070    ;
38071    if (element.hasPerformingOrganization()) {
38072      composeReference("performingOrganization", element.getPerformingOrganization());
38073    }
38074    if (element.hasRequestingOrganization()) {
38075      composeReference("requestingOrganization", element.getRequestingOrganization());
38076    }
38077    if (element.hasCostCenter()) {
38078      composeReference("costCenter", element.getCostCenter());
38079    }
38080    if (element.hasQuantity()) {
38081      composeQuantity("quantity", element.getQuantity());
38082    }
38083    if (element.hasBodysite()) {
38084      openArray("bodysite");
38085      for (CodeableConcept e : element.getBodysite())
38086        composeCodeableConcept(null, e);
38087      closeArray();
38088    }
38089    ;
38090    if (element.hasFactorOverrideElement()) {
38091      composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
38092      composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
38093    }
38094    if (element.hasPriceOverride()) {
38095      composeMoney("priceOverride", element.getPriceOverride());
38096    }
38097    if (element.hasOverrideReasonElement()) {
38098      composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
38099      composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
38100    }
38101    if (element.hasEnterer()) {
38102      composeReference("enterer", element.getEnterer());
38103    }
38104    if (element.hasEnteredDateElement()) {
38105      composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
38106      composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
38107    }
38108    if (element.hasReason()) {
38109      openArray("reason");
38110      for (CodeableConcept e : element.getReason())
38111        composeCodeableConcept(null, e);
38112      closeArray();
38113    }
38114    ;
38115    if (element.hasService()) {
38116      openArray("service");
38117      for (Reference e : element.getService())
38118        composeReference(null, e);
38119      closeArray();
38120    }
38121    ;
38122    if (element.hasProduct()) {
38123      composeType("product", element.getProduct());
38124    }
38125    if (element.hasAccount()) {
38126      openArray("account");
38127      for (Reference e : element.getAccount())
38128        composeReference(null, e);
38129      closeArray();
38130    }
38131    ;
38132    if (element.hasNote()) {
38133      openArray("note");
38134      for (Annotation e : element.getNote())
38135        composeAnnotation(null, e);
38136      closeArray();
38137    }
38138    ;
38139    if (element.hasSupportingInformation()) {
38140      openArray("supportingInformation");
38141      for (Reference e : element.getSupportingInformation())
38142        composeReference(null, e);
38143      closeArray();
38144    }
38145    ;
38146  }
38147
38148  protected void composeChargeItemChargeItemPerformerComponent(String name,
38149      ChargeItem.ChargeItemPerformerComponent element) throws IOException {
38150    if (element != null) {
38151      open(name);
38152      composeChargeItemChargeItemPerformerComponentInner(element);
38153      close();
38154    }
38155  }
38156
38157  protected void composeChargeItemChargeItemPerformerComponentInner(ChargeItem.ChargeItemPerformerComponent element)
38158      throws IOException {
38159    composeBackbone(element);
38160    if (element.hasFunction()) {
38161      composeCodeableConcept("function", element.getFunction());
38162    }
38163    if (element.hasActor()) {
38164      composeReference("actor", element.getActor());
38165    }
38166  }
38167
38168  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
38169    if (element != null) {
38170      prop("resourceType", name);
38171      composeChargeItemDefinitionInner(element);
38172    }
38173  }
38174
38175  protected void composeChargeItemDefinitionInner(ChargeItemDefinition element) throws IOException {
38176    composeDomainResourceElements(element);
38177    if (element.hasUrlElement()) {
38178      composeUriCore("url", element.getUrlElement(), false);
38179      composeUriExtras("url", element.getUrlElement(), false);
38180    }
38181    if (element.hasIdentifier()) {
38182      openArray("identifier");
38183      for (Identifier e : element.getIdentifier())
38184        composeIdentifier(null, e);
38185      closeArray();
38186    }
38187    ;
38188    if (element.hasVersionElement()) {
38189      composeStringCore("version", element.getVersionElement(), false);
38190      composeStringExtras("version", element.getVersionElement(), false);
38191    }
38192    if (element.hasTitleElement()) {
38193      composeStringCore("title", element.getTitleElement(), false);
38194      composeStringExtras("title", element.getTitleElement(), false);
38195    }
38196    if (element.hasDerivedFromUri()) {
38197      openArray("derivedFromUri");
38198      for (UriType e : element.getDerivedFromUri())
38199        composeUriCore(null, e, true);
38200      closeArray();
38201      if (anyHasExtras(element.getDerivedFromUri())) {
38202        openArray("_derivedFromUri");
38203        for (UriType e : element.getDerivedFromUri())
38204          composeUriExtras(null, e, true);
38205        closeArray();
38206      }
38207    }
38208    ;
38209    if (element.hasPartOf()) {
38210      openArray("partOf");
38211      for (CanonicalType e : element.getPartOf())
38212        composeCanonicalCore(null, e, true);
38213      closeArray();
38214      if (anyHasExtras(element.getPartOf())) {
38215        openArray("_partOf");
38216        for (CanonicalType e : element.getPartOf())
38217          composeCanonicalExtras(null, e, true);
38218        closeArray();
38219      }
38220    }
38221    ;
38222    if (element.hasReplaces()) {
38223      openArray("replaces");
38224      for (CanonicalType e : element.getReplaces())
38225        composeCanonicalCore(null, e, true);
38226      closeArray();
38227      if (anyHasExtras(element.getReplaces())) {
38228        openArray("_replaces");
38229        for (CanonicalType e : element.getReplaces())
38230          composeCanonicalExtras(null, e, true);
38231        closeArray();
38232      }
38233    }
38234    ;
38235    if (element.hasStatusElement()) {
38236      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
38237          false);
38238      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
38239          false);
38240    }
38241    if (element.hasExperimentalElement()) {
38242      composeBooleanCore("experimental", element.getExperimentalElement(), false);
38243      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38244    }
38245    if (element.hasDateElement()) {
38246      composeDateTimeCore("date", element.getDateElement(), false);
38247      composeDateTimeExtras("date", element.getDateElement(), false);
38248    }
38249    if (element.hasPublisherElement()) {
38250      composeStringCore("publisher", element.getPublisherElement(), false);
38251      composeStringExtras("publisher", element.getPublisherElement(), false);
38252    }
38253    if (element.hasContact()) {
38254      openArray("contact");
38255      for (ContactDetail e : element.getContact())
38256        composeContactDetail(null, e);
38257      closeArray();
38258    }
38259    ;
38260    if (element.hasDescriptionElement()) {
38261      composeMarkdownCore("description", element.getDescriptionElement(), false);
38262      composeMarkdownExtras("description", element.getDescriptionElement(), false);
38263    }
38264    if (element.hasUseContext()) {
38265      openArray("useContext");
38266      for (UsageContext e : element.getUseContext())
38267        composeUsageContext(null, e);
38268      closeArray();
38269    }
38270    ;
38271    if (element.hasJurisdiction()) {
38272      openArray("jurisdiction");
38273      for (CodeableConcept e : element.getJurisdiction())
38274        composeCodeableConcept(null, e);
38275      closeArray();
38276    }
38277    ;
38278    if (element.hasCopyrightElement()) {
38279      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38280      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38281    }
38282    if (element.hasApprovalDateElement()) {
38283      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
38284      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
38285    }
38286    if (element.hasLastReviewDateElement()) {
38287      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
38288      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
38289    }
38290    if (element.hasEffectivePeriod()) {
38291      composePeriod("effectivePeriod", element.getEffectivePeriod());
38292    }
38293    if (element.hasCode()) {
38294      composeCodeableConcept("code", element.getCode());
38295    }
38296    if (element.hasInstance()) {
38297      openArray("instance");
38298      for (Reference e : element.getInstance())
38299        composeReference(null, e);
38300      closeArray();
38301    }
38302    ;
38303    if (element.hasApplicability()) {
38304      openArray("applicability");
38305      for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability())
38306        composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
38307      closeArray();
38308    }
38309    ;
38310    if (element.hasPropertyGroup()) {
38311      openArray("propertyGroup");
38312      for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup())
38313        composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(null, e);
38314      closeArray();
38315    }
38316    ;
38317  }
38318
38319  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name,
38320      ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
38321    if (element != null) {
38322      open(name);
38323      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(element);
38324      close();
38325    }
38326  }
38327
38328  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(
38329      ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
38330    composeBackbone(element);
38331    if (element.hasDescriptionElement()) {
38332      composeStringCore("description", element.getDescriptionElement(), false);
38333      composeStringExtras("description", element.getDescriptionElement(), false);
38334    }
38335    if (element.hasLanguageElement()) {
38336      composeStringCore("language", element.getLanguageElement(), false);
38337      composeStringExtras("language", element.getLanguageElement(), false);
38338    }
38339    if (element.hasExpressionElement()) {
38340      composeStringCore("expression", element.getExpressionElement(), false);
38341      composeStringExtras("expression", element.getExpressionElement(), false);
38342    }
38343  }
38344
38345  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name,
38346      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
38347    if (element != null) {
38348      open(name);
38349      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(element);
38350      close();
38351    }
38352  }
38353
38354  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(
38355      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
38356    composeBackbone(element);
38357    if (element.hasApplicability()) {
38358      openArray("applicability");
38359      for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability())
38360        composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
38361      closeArray();
38362    }
38363    ;
38364    if (element.hasPriceComponent()) {
38365      openArray("priceComponent");
38366      for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element
38367          .getPriceComponent())
38368        composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
38369      closeArray();
38370    }
38371    ;
38372  }
38373
38374  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name,
38375      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
38376    if (element != null) {
38377      open(name);
38378      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(element);
38379      close();
38380    }
38381  }
38382
38383  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(
38384      ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
38385    composeBackbone(element);
38386    if (element.hasTypeElement()) {
38387      composeEnumerationCore("type", element.getTypeElement(),
38388          new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
38389      composeEnumerationExtras("type", element.getTypeElement(),
38390          new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
38391    }
38392    if (element.hasCode()) {
38393      composeCodeableConcept("code", element.getCode());
38394    }
38395    if (element.hasFactorElement()) {
38396      composeDecimalCore("factor", element.getFactorElement(), false);
38397      composeDecimalExtras("factor", element.getFactorElement(), false);
38398    }
38399    if (element.hasAmount()) {
38400      composeMoney("amount", element.getAmount());
38401    }
38402  }
38403
38404  protected void composeClaim(String name, Claim element) throws IOException {
38405    if (element != null) {
38406      prop("resourceType", name);
38407      composeClaimInner(element);
38408    }
38409  }
38410
38411  protected void composeClaimInner(Claim element) throws IOException {
38412    composeDomainResourceElements(element);
38413    if (element.hasIdentifier()) {
38414      openArray("identifier");
38415      for (Identifier e : element.getIdentifier())
38416        composeIdentifier(null, e);
38417      closeArray();
38418    }
38419    ;
38420    if (element.hasStatusElement()) {
38421      composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
38422      composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
38423    }
38424    if (element.hasType()) {
38425      composeCodeableConcept("type", element.getType());
38426    }
38427    if (element.hasSubType()) {
38428      composeCodeableConcept("subType", element.getSubType());
38429    }
38430    if (element.hasUseElement()) {
38431      composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
38432      composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
38433    }
38434    if (element.hasPatient()) {
38435      composeReference("patient", element.getPatient());
38436    }
38437    if (element.hasBillablePeriod()) {
38438      composePeriod("billablePeriod", element.getBillablePeriod());
38439    }
38440    if (element.hasCreatedElement()) {
38441      composeDateTimeCore("created", element.getCreatedElement(), false);
38442      composeDateTimeExtras("created", element.getCreatedElement(), false);
38443    }
38444    if (element.hasEnterer()) {
38445      composeReference("enterer", element.getEnterer());
38446    }
38447    if (element.hasInsurer()) {
38448      composeReference("insurer", element.getInsurer());
38449    }
38450    if (element.hasProvider()) {
38451      composeReference("provider", element.getProvider());
38452    }
38453    if (element.hasPriority()) {
38454      composeCodeableConcept("priority", element.getPriority());
38455    }
38456    if (element.hasFundsReserve()) {
38457      composeCodeableConcept("fundsReserve", element.getFundsReserve());
38458    }
38459    if (element.hasRelated()) {
38460      openArray("related");
38461      for (Claim.RelatedClaimComponent e : element.getRelated())
38462        composeClaimRelatedClaimComponent(null, e);
38463      closeArray();
38464    }
38465    ;
38466    if (element.hasPrescription()) {
38467      composeReference("prescription", element.getPrescription());
38468    }
38469    if (element.hasOriginalPrescription()) {
38470      composeReference("originalPrescription", element.getOriginalPrescription());
38471    }
38472    if (element.hasPayee()) {
38473      composeClaimPayeeComponent("payee", element.getPayee());
38474    }
38475    if (element.hasReferral()) {
38476      composeReference("referral", element.getReferral());
38477    }
38478    if (element.hasFacility()) {
38479      composeReference("facility", element.getFacility());
38480    }
38481    if (element.hasCareTeam()) {
38482      openArray("careTeam");
38483      for (Claim.CareTeamComponent e : element.getCareTeam())
38484        composeClaimCareTeamComponent(null, e);
38485      closeArray();
38486    }
38487    ;
38488    if (element.hasSupportingInfo()) {
38489      openArray("supportingInfo");
38490      for (Claim.SupportingInformationComponent e : element.getSupportingInfo())
38491        composeClaimSupportingInformationComponent(null, e);
38492      closeArray();
38493    }
38494    ;
38495    if (element.hasDiagnosis()) {
38496      openArray("diagnosis");
38497      for (Claim.DiagnosisComponent e : element.getDiagnosis())
38498        composeClaimDiagnosisComponent(null, e);
38499      closeArray();
38500    }
38501    ;
38502    if (element.hasProcedure()) {
38503      openArray("procedure");
38504      for (Claim.ProcedureComponent e : element.getProcedure())
38505        composeClaimProcedureComponent(null, e);
38506      closeArray();
38507    }
38508    ;
38509    if (element.hasInsurance()) {
38510      openArray("insurance");
38511      for (Claim.InsuranceComponent e : element.getInsurance())
38512        composeClaimInsuranceComponent(null, e);
38513      closeArray();
38514    }
38515    ;
38516    if (element.hasAccident()) {
38517      composeClaimAccidentComponent("accident", element.getAccident());
38518    }
38519    if (element.hasItem()) {
38520      openArray("item");
38521      for (Claim.ItemComponent e : element.getItem())
38522        composeClaimItemComponent(null, e);
38523      closeArray();
38524    }
38525    ;
38526    if (element.hasTotal()) {
38527      composeMoney("total", element.getTotal());
38528    }
38529  }
38530
38531  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element)
38532      throws IOException {
38533    if (element != null) {
38534      open(name);
38535      composeClaimRelatedClaimComponentInner(element);
38536      close();
38537    }
38538  }
38539
38540  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
38541    composeBackbone(element);
38542    if (element.hasClaim()) {
38543      composeReference("claim", element.getClaim());
38544    }
38545    if (element.hasRelationship()) {
38546      composeCodeableConcept("relationship", element.getRelationship());
38547    }
38548    if (element.hasReference()) {
38549      composeIdentifier("reference", element.getReference());
38550    }
38551  }
38552
38553  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
38554    if (element != null) {
38555      open(name);
38556      composeClaimPayeeComponentInner(element);
38557      close();
38558    }
38559  }
38560
38561  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
38562    composeBackbone(element);
38563    if (element.hasType()) {
38564      composeCodeableConcept("type", element.getType());
38565    }
38566    if (element.hasParty()) {
38567      composeReference("party", element.getParty());
38568    }
38569  }
38570
38571  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
38572    if (element != null) {
38573      open(name);
38574      composeClaimCareTeamComponentInner(element);
38575      close();
38576    }
38577  }
38578
38579  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
38580    composeBackbone(element);
38581    if (element.hasSequenceElement()) {
38582      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38583      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38584    }
38585    if (element.hasProvider()) {
38586      composeReference("provider", element.getProvider());
38587    }
38588    if (element.hasResponsibleElement()) {
38589      composeBooleanCore("responsible", element.getResponsibleElement(), false);
38590      composeBooleanExtras("responsible", element.getResponsibleElement(), false);
38591    }
38592    if (element.hasRole()) {
38593      composeCodeableConcept("role", element.getRole());
38594    }
38595    if (element.hasQualification()) {
38596      composeCodeableConcept("qualification", element.getQualification());
38597    }
38598  }
38599
38600  protected void composeClaimSupportingInformationComponent(String name, Claim.SupportingInformationComponent element)
38601      throws IOException {
38602    if (element != null) {
38603      open(name);
38604      composeClaimSupportingInformationComponentInner(element);
38605      close();
38606    }
38607  }
38608
38609  protected void composeClaimSupportingInformationComponentInner(Claim.SupportingInformationComponent element)
38610      throws IOException {
38611    composeBackbone(element);
38612    if (element.hasSequenceElement()) {
38613      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38614      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38615    }
38616    if (element.hasCategory()) {
38617      composeCodeableConcept("category", element.getCategory());
38618    }
38619    if (element.hasCode()) {
38620      composeCodeableConcept("code", element.getCode());
38621    }
38622    if (element.hasTiming()) {
38623      composeType("timing", element.getTiming());
38624    }
38625    if (element.hasValue()) {
38626      composeType("value", element.getValue());
38627    }
38628    if (element.hasReason()) {
38629      composeCodeableConcept("reason", element.getReason());
38630    }
38631  }
38632
38633  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
38634    if (element != null) {
38635      open(name);
38636      composeClaimDiagnosisComponentInner(element);
38637      close();
38638    }
38639  }
38640
38641  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
38642    composeBackbone(element);
38643    if (element.hasSequenceElement()) {
38644      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38645      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38646    }
38647    if (element.hasDiagnosis()) {
38648      composeType("diagnosis", element.getDiagnosis());
38649    }
38650    if (element.hasType()) {
38651      openArray("type");
38652      for (CodeableConcept e : element.getType())
38653        composeCodeableConcept(null, e);
38654      closeArray();
38655    }
38656    ;
38657    if (element.hasOnAdmission()) {
38658      composeCodeableConcept("onAdmission", element.getOnAdmission());
38659    }
38660    if (element.hasPackageCode()) {
38661      composeCodeableConcept("packageCode", element.getPackageCode());
38662    }
38663  }
38664
38665  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
38666    if (element != null) {
38667      open(name);
38668      composeClaimProcedureComponentInner(element);
38669      close();
38670    }
38671  }
38672
38673  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
38674    composeBackbone(element);
38675    if (element.hasSequenceElement()) {
38676      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38677      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38678    }
38679    if (element.hasType()) {
38680      openArray("type");
38681      for (CodeableConcept e : element.getType())
38682        composeCodeableConcept(null, e);
38683      closeArray();
38684    }
38685    ;
38686    if (element.hasDateElement()) {
38687      composeDateTimeCore("date", element.getDateElement(), false);
38688      composeDateTimeExtras("date", element.getDateElement(), false);
38689    }
38690    if (element.hasProcedure()) {
38691      composeType("procedure", element.getProcedure());
38692    }
38693    if (element.hasUdi()) {
38694      openArray("udi");
38695      for (Reference e : element.getUdi())
38696        composeReference(null, e);
38697      closeArray();
38698    }
38699    ;
38700  }
38701
38702  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
38703    if (element != null) {
38704      open(name);
38705      composeClaimInsuranceComponentInner(element);
38706      close();
38707    }
38708  }
38709
38710  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
38711    composeBackbone(element);
38712    if (element.hasSequenceElement()) {
38713      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38714      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38715    }
38716    if (element.hasFocalElement()) {
38717      composeBooleanCore("focal", element.getFocalElement(), false);
38718      composeBooleanExtras("focal", element.getFocalElement(), false);
38719    }
38720    if (element.hasIdentifier()) {
38721      composeIdentifier("identifier", element.getIdentifier());
38722    }
38723    if (element.hasCoverage()) {
38724      composeReference("coverage", element.getCoverage());
38725    }
38726    if (element.hasBusinessArrangementElement()) {
38727      composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
38728      composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
38729    }
38730    if (element.hasPreAuthRef()) {
38731      openArray("preAuthRef");
38732      for (StringType e : element.getPreAuthRef())
38733        composeStringCore(null, e, true);
38734      closeArray();
38735      if (anyHasExtras(element.getPreAuthRef())) {
38736        openArray("_preAuthRef");
38737        for (StringType e : element.getPreAuthRef())
38738          composeStringExtras(null, e, true);
38739        closeArray();
38740      }
38741    }
38742    ;
38743    if (element.hasClaimResponse()) {
38744      composeReference("claimResponse", element.getClaimResponse());
38745    }
38746  }
38747
38748  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
38749    if (element != null) {
38750      open(name);
38751      composeClaimAccidentComponentInner(element);
38752      close();
38753    }
38754  }
38755
38756  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
38757    composeBackbone(element);
38758    if (element.hasDateElement()) {
38759      composeDateCore("date", element.getDateElement(), false);
38760      composeDateExtras("date", element.getDateElement(), false);
38761    }
38762    if (element.hasType()) {
38763      composeCodeableConcept("type", element.getType());
38764    }
38765    if (element.hasLocation()) {
38766      composeType("location", element.getLocation());
38767    }
38768  }
38769
38770  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
38771    if (element != null) {
38772      open(name);
38773      composeClaimItemComponentInner(element);
38774      close();
38775    }
38776  }
38777
38778  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
38779    composeBackbone(element);
38780    if (element.hasSequenceElement()) {
38781      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38782      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38783    }
38784    if (element.hasCareTeamSequence()) {
38785      openArray("careTeamSequence");
38786      for (PositiveIntType e : element.getCareTeamSequence())
38787        composePositiveIntCore(null, e, true);
38788      closeArray();
38789      if (anyHasExtras(element.getCareTeamSequence())) {
38790        openArray("_careTeamSequence");
38791        for (PositiveIntType e : element.getCareTeamSequence())
38792          composePositiveIntExtras(null, e, true);
38793        closeArray();
38794      }
38795    }
38796    ;
38797    if (element.hasDiagnosisSequence()) {
38798      openArray("diagnosisSequence");
38799      for (PositiveIntType e : element.getDiagnosisSequence())
38800        composePositiveIntCore(null, e, true);
38801      closeArray();
38802      if (anyHasExtras(element.getDiagnosisSequence())) {
38803        openArray("_diagnosisSequence");
38804        for (PositiveIntType e : element.getDiagnosisSequence())
38805          composePositiveIntExtras(null, e, true);
38806        closeArray();
38807      }
38808    }
38809    ;
38810    if (element.hasProcedureSequence()) {
38811      openArray("procedureSequence");
38812      for (PositiveIntType e : element.getProcedureSequence())
38813        composePositiveIntCore(null, e, true);
38814      closeArray();
38815      if (anyHasExtras(element.getProcedureSequence())) {
38816        openArray("_procedureSequence");
38817        for (PositiveIntType e : element.getProcedureSequence())
38818          composePositiveIntExtras(null, e, true);
38819        closeArray();
38820      }
38821    }
38822    ;
38823    if (element.hasInformationSequence()) {
38824      openArray("informationSequence");
38825      for (PositiveIntType e : element.getInformationSequence())
38826        composePositiveIntCore(null, e, true);
38827      closeArray();
38828      if (anyHasExtras(element.getInformationSequence())) {
38829        openArray("_informationSequence");
38830        for (PositiveIntType e : element.getInformationSequence())
38831          composePositiveIntExtras(null, e, true);
38832        closeArray();
38833      }
38834    }
38835    ;
38836    if (element.hasRevenue()) {
38837      composeCodeableConcept("revenue", element.getRevenue());
38838    }
38839    if (element.hasCategory()) {
38840      composeCodeableConcept("category", element.getCategory());
38841    }
38842    if (element.hasProductOrService()) {
38843      composeCodeableConcept("productOrService", element.getProductOrService());
38844    }
38845    if (element.hasModifier()) {
38846      openArray("modifier");
38847      for (CodeableConcept e : element.getModifier())
38848        composeCodeableConcept(null, e);
38849      closeArray();
38850    }
38851    ;
38852    if (element.hasProgramCode()) {
38853      openArray("programCode");
38854      for (CodeableConcept e : element.getProgramCode())
38855        composeCodeableConcept(null, e);
38856      closeArray();
38857    }
38858    ;
38859    if (element.hasServiced()) {
38860      composeType("serviced", element.getServiced());
38861    }
38862    if (element.hasLocation()) {
38863      composeType("location", element.getLocation());
38864    }
38865    if (element.hasQuantity()) {
38866      composeQuantity("quantity", element.getQuantity());
38867    }
38868    if (element.hasUnitPrice()) {
38869      composeMoney("unitPrice", element.getUnitPrice());
38870    }
38871    if (element.hasFactorElement()) {
38872      composeDecimalCore("factor", element.getFactorElement(), false);
38873      composeDecimalExtras("factor", element.getFactorElement(), false);
38874    }
38875    if (element.hasNet()) {
38876      composeMoney("net", element.getNet());
38877    }
38878    if (element.hasUdi()) {
38879      openArray("udi");
38880      for (Reference e : element.getUdi())
38881        composeReference(null, e);
38882      closeArray();
38883    }
38884    ;
38885    if (element.hasBodySite()) {
38886      composeCodeableConcept("bodySite", element.getBodySite());
38887    }
38888    if (element.hasSubSite()) {
38889      openArray("subSite");
38890      for (CodeableConcept e : element.getSubSite())
38891        composeCodeableConcept(null, e);
38892      closeArray();
38893    }
38894    ;
38895    if (element.hasEncounter()) {
38896      openArray("encounter");
38897      for (Reference e : element.getEncounter())
38898        composeReference(null, e);
38899      closeArray();
38900    }
38901    ;
38902    if (element.hasDetail()) {
38903      openArray("detail");
38904      for (Claim.DetailComponent e : element.getDetail())
38905        composeClaimDetailComponent(null, e);
38906      closeArray();
38907    }
38908    ;
38909  }
38910
38911  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
38912    if (element != null) {
38913      open(name);
38914      composeClaimDetailComponentInner(element);
38915      close();
38916    }
38917  }
38918
38919  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
38920    composeBackbone(element);
38921    if (element.hasSequenceElement()) {
38922      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38923      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38924    }
38925    if (element.hasRevenue()) {
38926      composeCodeableConcept("revenue", element.getRevenue());
38927    }
38928    if (element.hasCategory()) {
38929      composeCodeableConcept("category", element.getCategory());
38930    }
38931    if (element.hasProductOrService()) {
38932      composeCodeableConcept("productOrService", element.getProductOrService());
38933    }
38934    if (element.hasModifier()) {
38935      openArray("modifier");
38936      for (CodeableConcept e : element.getModifier())
38937        composeCodeableConcept(null, e);
38938      closeArray();
38939    }
38940    ;
38941    if (element.hasProgramCode()) {
38942      openArray("programCode");
38943      for (CodeableConcept e : element.getProgramCode())
38944        composeCodeableConcept(null, e);
38945      closeArray();
38946    }
38947    ;
38948    if (element.hasQuantity()) {
38949      composeQuantity("quantity", element.getQuantity());
38950    }
38951    if (element.hasUnitPrice()) {
38952      composeMoney("unitPrice", element.getUnitPrice());
38953    }
38954    if (element.hasFactorElement()) {
38955      composeDecimalCore("factor", element.getFactorElement(), false);
38956      composeDecimalExtras("factor", element.getFactorElement(), false);
38957    }
38958    if (element.hasNet()) {
38959      composeMoney("net", element.getNet());
38960    }
38961    if (element.hasUdi()) {
38962      openArray("udi");
38963      for (Reference e : element.getUdi())
38964        composeReference(null, e);
38965      closeArray();
38966    }
38967    ;
38968    if (element.hasSubDetail()) {
38969      openArray("subDetail");
38970      for (Claim.SubDetailComponent e : element.getSubDetail())
38971        composeClaimSubDetailComponent(null, e);
38972      closeArray();
38973    }
38974    ;
38975  }
38976
38977  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
38978    if (element != null) {
38979      open(name);
38980      composeClaimSubDetailComponentInner(element);
38981      close();
38982    }
38983  }
38984
38985  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
38986    composeBackbone(element);
38987    if (element.hasSequenceElement()) {
38988      composePositiveIntCore("sequence", element.getSequenceElement(), false);
38989      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38990    }
38991    if (element.hasRevenue()) {
38992      composeCodeableConcept("revenue", element.getRevenue());
38993    }
38994    if (element.hasCategory()) {
38995      composeCodeableConcept("category", element.getCategory());
38996    }
38997    if (element.hasProductOrService()) {
38998      composeCodeableConcept("productOrService", element.getProductOrService());
38999    }
39000    if (element.hasModifier()) {
39001      openArray("modifier");
39002      for (CodeableConcept e : element.getModifier())
39003        composeCodeableConcept(null, e);
39004      closeArray();
39005    }
39006    ;
39007    if (element.hasProgramCode()) {
39008      openArray("programCode");
39009      for (CodeableConcept e : element.getProgramCode())
39010        composeCodeableConcept(null, e);
39011      closeArray();
39012    }
39013    ;
39014    if (element.hasQuantity()) {
39015      composeQuantity("quantity", element.getQuantity());
39016    }
39017    if (element.hasUnitPrice()) {
39018      composeMoney("unitPrice", element.getUnitPrice());
39019    }
39020    if (element.hasFactorElement()) {
39021      composeDecimalCore("factor", element.getFactorElement(), false);
39022      composeDecimalExtras("factor", element.getFactorElement(), false);
39023    }
39024    if (element.hasNet()) {
39025      composeMoney("net", element.getNet());
39026    }
39027    if (element.hasUdi()) {
39028      openArray("udi");
39029      for (Reference e : element.getUdi())
39030        composeReference(null, e);
39031      closeArray();
39032    }
39033    ;
39034  }
39035
39036  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
39037    if (element != null) {
39038      prop("resourceType", name);
39039      composeClaimResponseInner(element);
39040    }
39041  }
39042
39043  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
39044    composeDomainResourceElements(element);
39045    if (element.hasIdentifier()) {
39046      openArray("identifier");
39047      for (Identifier e : element.getIdentifier())
39048        composeIdentifier(null, e);
39049      closeArray();
39050    }
39051    ;
39052    if (element.hasStatusElement()) {
39053      composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(),
39054          false);
39055      composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(),
39056          false);
39057    }
39058    if (element.hasType()) {
39059      composeCodeableConcept("type", element.getType());
39060    }
39061    if (element.hasSubType()) {
39062      composeCodeableConcept("subType", element.getSubType());
39063    }
39064    if (element.hasUseElement()) {
39065      composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
39066      composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
39067    }
39068    if (element.hasPatient()) {
39069      composeReference("patient", element.getPatient());
39070    }
39071    if (element.hasCreatedElement()) {
39072      composeDateTimeCore("created", element.getCreatedElement(), false);
39073      composeDateTimeExtras("created", element.getCreatedElement(), false);
39074    }
39075    if (element.hasInsurer()) {
39076      composeReference("insurer", element.getInsurer());
39077    }
39078    if (element.hasRequestor()) {
39079      composeReference("requestor", element.getRequestor());
39080    }
39081    if (element.hasRequest()) {
39082      composeReference("request", element.getRequest());
39083    }
39084    if (element.hasOutcomeElement()) {
39085      composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(),
39086          false);
39087      composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(),
39088          false);
39089    }
39090    if (element.hasDispositionElement()) {
39091      composeStringCore("disposition", element.getDispositionElement(), false);
39092      composeStringExtras("disposition", element.getDispositionElement(), false);
39093    }
39094    if (element.hasPreAuthRefElement()) {
39095      composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
39096      composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
39097    }
39098    if (element.hasPreAuthPeriod()) {
39099      composePeriod("preAuthPeriod", element.getPreAuthPeriod());
39100    }
39101    if (element.hasPayeeType()) {
39102      composeCodeableConcept("payeeType", element.getPayeeType());
39103    }
39104    if (element.hasItem()) {
39105      openArray("item");
39106      for (ClaimResponse.ItemComponent e : element.getItem())
39107        composeClaimResponseItemComponent(null, e);
39108      closeArray();
39109    }
39110    ;
39111    if (element.hasAddItem()) {
39112      openArray("addItem");
39113      for (ClaimResponse.AddedItemComponent e : element.getAddItem())
39114        composeClaimResponseAddedItemComponent(null, e);
39115      closeArray();
39116    }
39117    ;
39118    if (element.hasAdjudication()) {
39119      openArray("adjudication");
39120      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
39121        composeClaimResponseAdjudicationComponent(null, e);
39122      closeArray();
39123    }
39124    ;
39125    if (element.hasTotal()) {
39126      openArray("total");
39127      for (ClaimResponse.TotalComponent e : element.getTotal())
39128        composeClaimResponseTotalComponent(null, e);
39129      closeArray();
39130    }
39131    ;
39132    if (element.hasPayment()) {
39133      composeClaimResponsePaymentComponent("payment", element.getPayment());
39134    }
39135    if (element.hasFundsReserve()) {
39136      composeCodeableConcept("fundsReserve", element.getFundsReserve());
39137    }
39138    if (element.hasFormCode()) {
39139      composeCodeableConcept("formCode", element.getFormCode());
39140    }
39141    if (element.hasForm()) {
39142      composeAttachment("form", element.getForm());
39143    }
39144    if (element.hasProcessNote()) {
39145      openArray("processNote");
39146      for (ClaimResponse.NoteComponent e : element.getProcessNote())
39147        composeClaimResponseNoteComponent(null, e);
39148      closeArray();
39149    }
39150    ;
39151    if (element.hasCommunicationRequest()) {
39152      openArray("communicationRequest");
39153      for (Reference e : element.getCommunicationRequest())
39154        composeReference(null, e);
39155      closeArray();
39156    }
39157    ;
39158    if (element.hasInsurance()) {
39159      openArray("insurance");
39160      for (ClaimResponse.InsuranceComponent e : element.getInsurance())
39161        composeClaimResponseInsuranceComponent(null, e);
39162      closeArray();
39163    }
39164    ;
39165    if (element.hasError()) {
39166      openArray("error");
39167      for (ClaimResponse.ErrorComponent e : element.getError())
39168        composeClaimResponseErrorComponent(null, e);
39169      closeArray();
39170    }
39171    ;
39172  }
39173
39174  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element)
39175      throws IOException {
39176    if (element != null) {
39177      open(name);
39178      composeClaimResponseItemComponentInner(element);
39179      close();
39180    }
39181  }
39182
39183  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
39184    composeBackbone(element);
39185    if (element.hasItemSequenceElement()) {
39186      composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
39187      composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
39188    }
39189    if (element.hasNoteNumber()) {
39190      openArray("noteNumber");
39191      for (PositiveIntType e : element.getNoteNumber())
39192        composePositiveIntCore(null, e, true);
39193      closeArray();
39194      if (anyHasExtras(element.getNoteNumber())) {
39195        openArray("_noteNumber");
39196        for (PositiveIntType e : element.getNoteNumber())
39197          composePositiveIntExtras(null, e, true);
39198        closeArray();
39199      }
39200    }
39201    ;
39202    if (element.hasAdjudication()) {
39203      openArray("adjudication");
39204      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
39205        composeClaimResponseAdjudicationComponent(null, e);
39206      closeArray();
39207    }
39208    ;
39209    if (element.hasDetail()) {
39210      openArray("detail");
39211      for (ClaimResponse.ItemDetailComponent e : element.getDetail())
39212        composeClaimResponseItemDetailComponent(null, e);
39213      closeArray();
39214    }
39215    ;
39216  }
39217
39218  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element)
39219      throws IOException {
39220    if (element != null) {
39221      open(name);
39222      composeClaimResponseAdjudicationComponentInner(element);
39223      close();
39224    }
39225  }
39226
39227  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element)
39228      throws IOException {
39229    composeBackbone(element);
39230    if (element.hasCategory()) {
39231      composeCodeableConcept("category", element.getCategory());
39232    }
39233    if (element.hasReason()) {
39234      composeCodeableConcept("reason", element.getReason());
39235    }
39236    if (element.hasAmount()) {
39237      composeMoney("amount", element.getAmount());
39238    }
39239    if (element.hasValueElement()) {
39240      composeDecimalCore("value", element.getValueElement(), false);
39241      composeDecimalExtras("value", element.getValueElement(), false);
39242    }
39243  }
39244
39245  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element)
39246      throws IOException {
39247    if (element != null) {
39248      open(name);
39249      composeClaimResponseItemDetailComponentInner(element);
39250      close();
39251    }
39252  }
39253
39254  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element)
39255      throws IOException {
39256    composeBackbone(element);
39257    if (element.hasDetailSequenceElement()) {
39258      composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
39259      composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
39260    }
39261    if (element.hasNoteNumber()) {
39262      openArray("noteNumber");
39263      for (PositiveIntType e : element.getNoteNumber())
39264        composePositiveIntCore(null, e, true);
39265      closeArray();
39266      if (anyHasExtras(element.getNoteNumber())) {
39267        openArray("_noteNumber");
39268        for (PositiveIntType e : element.getNoteNumber())
39269          composePositiveIntExtras(null, e, true);
39270        closeArray();
39271      }
39272    }
39273    ;
39274    if (element.hasAdjudication()) {
39275      openArray("adjudication");
39276      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
39277        composeClaimResponseAdjudicationComponent(null, e);
39278      closeArray();
39279    }
39280    ;
39281    if (element.hasSubDetail()) {
39282      openArray("subDetail");
39283      for (ClaimResponse.SubDetailComponent e : element.getSubDetail())
39284        composeClaimResponseSubDetailComponent(null, e);
39285      closeArray();
39286    }
39287    ;
39288  }
39289
39290  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element)
39291      throws IOException {
39292    if (element != null) {
39293      open(name);
39294      composeClaimResponseSubDetailComponentInner(element);
39295      close();
39296    }
39297  }
39298
39299  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element)
39300      throws IOException {
39301    composeBackbone(element);
39302    if (element.hasSubDetailSequenceElement()) {
39303      composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
39304      composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
39305    }
39306    if (element.hasNoteNumber()) {
39307      openArray("noteNumber");
39308      for (PositiveIntType e : element.getNoteNumber())
39309        composePositiveIntCore(null, e, true);
39310      closeArray();
39311      if (anyHasExtras(element.getNoteNumber())) {
39312        openArray("_noteNumber");
39313        for (PositiveIntType e : element.getNoteNumber())
39314          composePositiveIntExtras(null, e, true);
39315        closeArray();
39316      }
39317    }
39318    ;
39319    if (element.hasAdjudication()) {
39320      openArray("adjudication");
39321      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
39322        composeClaimResponseAdjudicationComponent(null, e);
39323      closeArray();
39324    }
39325    ;
39326  }
39327
39328  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element)
39329      throws IOException {
39330    if (element != null) {
39331      open(name);
39332      composeClaimResponseAddedItemComponentInner(element);
39333      close();
39334    }
39335  }
39336
39337  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element)
39338      throws IOException {
39339    composeBackbone(element);
39340    if (element.hasItemSequence()) {
39341      openArray("itemSequence");
39342      for (PositiveIntType e : element.getItemSequence())
39343        composePositiveIntCore(null, e, true);
39344      closeArray();
39345      if (anyHasExtras(element.getItemSequence())) {
39346        openArray("_itemSequence");
39347        for (PositiveIntType e : element.getItemSequence())
39348          composePositiveIntExtras(null, e, true);
39349        closeArray();
39350      }
39351    }
39352    ;
39353    if (element.hasDetailSequence()) {
39354      openArray("detailSequence");
39355      for (PositiveIntType e : element.getDetailSequence())
39356        composePositiveIntCore(null, e, true);
39357      closeArray();
39358      if (anyHasExtras(element.getDetailSequence())) {
39359        openArray("_detailSequence");
39360        for (PositiveIntType e : element.getDetailSequence())
39361          composePositiveIntExtras(null, e, true);
39362        closeArray();
39363      }
39364    }
39365    ;
39366    if (element.hasSubdetailSequence()) {
39367      openArray("subdetailSequence");
39368      for (PositiveIntType e : element.getSubdetailSequence())
39369        composePositiveIntCore(null, e, true);
39370      closeArray();
39371      if (anyHasExtras(element.getSubdetailSequence())) {
39372        openArray("_subdetailSequence");
39373        for (PositiveIntType e : element.getSubdetailSequence())
39374          composePositiveIntExtras(null, e, true);
39375        closeArray();
39376      }
39377    }
39378    ;
39379    if (element.hasProvider()) {
39380      openArray("provider");
39381      for (Reference e : element.getProvider())
39382        composeReference(null, e);
39383      closeArray();
39384    }
39385    ;
39386    if (element.hasProductOrService()) {
39387      composeCodeableConcept("productOrService", element.getProductOrService());
39388    }
39389    if (element.hasModifier()) {
39390      openArray("modifier");
39391      for (CodeableConcept e : element.getModifier())
39392        composeCodeableConcept(null, e);
39393      closeArray();
39394    }
39395    ;
39396    if (element.hasProgramCode()) {
39397      openArray("programCode");
39398      for (CodeableConcept e : element.getProgramCode())
39399        composeCodeableConcept(null, e);
39400      closeArray();
39401    }
39402    ;
39403    if (element.hasServiced()) {
39404      composeType("serviced", element.getServiced());
39405    }
39406    if (element.hasLocation()) {
39407      composeType("location", element.getLocation());
39408    }
39409    if (element.hasQuantity()) {
39410      composeQuantity("quantity", element.getQuantity());
39411    }
39412    if (element.hasUnitPrice()) {
39413      composeMoney("unitPrice", element.getUnitPrice());
39414    }
39415    if (element.hasFactorElement()) {
39416      composeDecimalCore("factor", element.getFactorElement(), false);
39417      composeDecimalExtras("factor", element.getFactorElement(), false);
39418    }
39419    if (element.hasNet()) {
39420      composeMoney("net", element.getNet());
39421    }
39422    if (element.hasBodySite()) {
39423      composeCodeableConcept("bodySite", element.getBodySite());
39424    }
39425    if (element.hasSubSite()) {
39426      openArray("subSite");
39427      for (CodeableConcept e : element.getSubSite())
39428        composeCodeableConcept(null, e);
39429      closeArray();
39430    }
39431    ;
39432    if (element.hasNoteNumber()) {
39433      openArray("noteNumber");
39434      for (PositiveIntType e : element.getNoteNumber())
39435        composePositiveIntCore(null, e, true);
39436      closeArray();
39437      if (anyHasExtras(element.getNoteNumber())) {
39438        openArray("_noteNumber");
39439        for (PositiveIntType e : element.getNoteNumber())
39440          composePositiveIntExtras(null, e, true);
39441        closeArray();
39442      }
39443    }
39444    ;
39445    if (element.hasAdjudication()) {
39446      openArray("adjudication");
39447      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
39448        composeClaimResponseAdjudicationComponent(null, e);
39449      closeArray();
39450    }
39451    ;
39452    if (element.hasDetail()) {
39453      openArray("detail");
39454      for (ClaimResponse.AddedItemDetailComponent e : element.getDetail())
39455        composeClaimResponseAddedItemDetailComponent(null, e);
39456      closeArray();
39457    }
39458    ;
39459  }
39460
39461  protected void composeClaimResponseAddedItemDetailComponent(String name,
39462      ClaimResponse.AddedItemDetailComponent element) throws IOException {
39463    if (element != null) {
39464      open(name);
39465      composeClaimResponseAddedItemDetailComponentInner(element);
39466      close();
39467    }
39468  }
39469
39470  protected void composeClaimResponseAddedItemDetailComponentInner(ClaimResponse.AddedItemDetailComponent element)
39471      throws IOException {
39472    composeBackbone(element);
39473    if (element.hasProductOrService()) {
39474      composeCodeableConcept("productOrService", element.getProductOrService());
39475    }
39476    if (element.hasModifier()) {
39477      openArray("modifier");
39478      for (CodeableConcept e : element.getModifier())
39479        composeCodeableConcept(null, e);
39480      closeArray();
39481    }
39482    ;
39483    if (element.hasQuantity()) {
39484      composeQuantity("quantity", element.getQuantity());
39485    }
39486    if (element.hasUnitPrice()) {
39487      composeMoney("unitPrice", element.getUnitPrice());
39488    }
39489    if (element.hasFactorElement()) {
39490      composeDecimalCore("factor", element.getFactorElement(), false);
39491      composeDecimalExtras("factor", element.getFactorElement(), false);
39492    }
39493    if (element.hasNet()) {
39494      composeMoney("net", element.getNet());
39495    }
39496    if (element.hasNoteNumber()) {
39497      openArray("noteNumber");
39498      for (PositiveIntType e : element.getNoteNumber())
39499        composePositiveIntCore(null, e, true);
39500      closeArray();
39501      if (anyHasExtras(element.getNoteNumber())) {
39502        openArray("_noteNumber");
39503        for (PositiveIntType e : element.getNoteNumber())
39504          composePositiveIntExtras(null, e, true);
39505        closeArray();
39506      }
39507    }
39508    ;
39509    if (element.hasAdjudication()) {
39510      openArray("adjudication");
39511      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
39512        composeClaimResponseAdjudicationComponent(null, e);
39513      closeArray();
39514    }
39515    ;
39516    if (element.hasSubDetail()) {
39517      openArray("subDetail");
39518      for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail())
39519        composeClaimResponseAddedItemSubDetailComponent(null, e);
39520      closeArray();
39521    }
39522    ;
39523  }
39524
39525  protected void composeClaimResponseAddedItemSubDetailComponent(String name,
39526      ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
39527    if (element != null) {
39528      open(name);
39529      composeClaimResponseAddedItemSubDetailComponentInner(element);
39530      close();
39531    }
39532  }
39533
39534  protected void composeClaimResponseAddedItemSubDetailComponentInner(ClaimResponse.AddedItemSubDetailComponent element)
39535      throws IOException {
39536    composeBackbone(element);
39537    if (element.hasProductOrService()) {
39538      composeCodeableConcept("productOrService", element.getProductOrService());
39539    }
39540    if (element.hasModifier()) {
39541      openArray("modifier");
39542      for (CodeableConcept e : element.getModifier())
39543        composeCodeableConcept(null, e);
39544      closeArray();
39545    }
39546    ;
39547    if (element.hasQuantity()) {
39548      composeQuantity("quantity", element.getQuantity());
39549    }
39550    if (element.hasUnitPrice()) {
39551      composeMoney("unitPrice", element.getUnitPrice());
39552    }
39553    if (element.hasFactorElement()) {
39554      composeDecimalCore("factor", element.getFactorElement(), false);
39555      composeDecimalExtras("factor", element.getFactorElement(), false);
39556    }
39557    if (element.hasNet()) {
39558      composeMoney("net", element.getNet());
39559    }
39560    if (element.hasNoteNumber()) {
39561      openArray("noteNumber");
39562      for (PositiveIntType e : element.getNoteNumber())
39563        composePositiveIntCore(null, e, true);
39564      closeArray();
39565      if (anyHasExtras(element.getNoteNumber())) {
39566        openArray("_noteNumber");
39567        for (PositiveIntType e : element.getNoteNumber())
39568          composePositiveIntExtras(null, e, true);
39569        closeArray();
39570      }
39571    }
39572    ;
39573    if (element.hasAdjudication()) {
39574      openArray("adjudication");
39575      for (ClaimResponse.AdjudicationComponent e : element.getAdjudication())
39576        composeClaimResponseAdjudicationComponent(null, e);
39577      closeArray();
39578    }
39579    ;
39580  }
39581
39582  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element)
39583      throws IOException {
39584    if (element != null) {
39585      open(name);
39586      composeClaimResponseTotalComponentInner(element);
39587      close();
39588    }
39589  }
39590
39591  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
39592    composeBackbone(element);
39593    if (element.hasCategory()) {
39594      composeCodeableConcept("category", element.getCategory());
39595    }
39596    if (element.hasAmount()) {
39597      composeMoney("amount", element.getAmount());
39598    }
39599  }
39600
39601  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element)
39602      throws IOException {
39603    if (element != null) {
39604      open(name);
39605      composeClaimResponsePaymentComponentInner(element);
39606      close();
39607    }
39608  }
39609
39610  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
39611    composeBackbone(element);
39612    if (element.hasType()) {
39613      composeCodeableConcept("type", element.getType());
39614    }
39615    if (element.hasAdjustment()) {
39616      composeMoney("adjustment", element.getAdjustment());
39617    }
39618    if (element.hasAdjustmentReason()) {
39619      composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
39620    }
39621    if (element.hasDateElement()) {
39622      composeDateCore("date", element.getDateElement(), false);
39623      composeDateExtras("date", element.getDateElement(), false);
39624    }
39625    if (element.hasAmount()) {
39626      composeMoney("amount", element.getAmount());
39627    }
39628    if (element.hasIdentifier()) {
39629      composeIdentifier("identifier", element.getIdentifier());
39630    }
39631  }
39632
39633  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element)
39634      throws IOException {
39635    if (element != null) {
39636      open(name);
39637      composeClaimResponseNoteComponentInner(element);
39638      close();
39639    }
39640  }
39641
39642  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
39643    composeBackbone(element);
39644    if (element.hasNumberElement()) {
39645      composePositiveIntCore("number", element.getNumberElement(), false);
39646      composePositiveIntExtras("number", element.getNumberElement(), false);
39647    }
39648    if (element.hasTypeElement()) {
39649      composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
39650      composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
39651    }
39652    if (element.hasTextElement()) {
39653      composeStringCore("text", element.getTextElement(), false);
39654      composeStringExtras("text", element.getTextElement(), false);
39655    }
39656    if (element.hasLanguage()) {
39657      composeCodeableConcept("language", element.getLanguage());
39658    }
39659  }
39660
39661  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element)
39662      throws IOException {
39663    if (element != null) {
39664      open(name);
39665      composeClaimResponseInsuranceComponentInner(element);
39666      close();
39667    }
39668  }
39669
39670  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element)
39671      throws IOException {
39672    composeBackbone(element);
39673    if (element.hasSequenceElement()) {
39674      composePositiveIntCore("sequence", element.getSequenceElement(), false);
39675      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39676    }
39677    if (element.hasFocalElement()) {
39678      composeBooleanCore("focal", element.getFocalElement(), false);
39679      composeBooleanExtras("focal", element.getFocalElement(), false);
39680    }
39681    if (element.hasCoverage()) {
39682      composeReference("coverage", element.getCoverage());
39683    }
39684    if (element.hasBusinessArrangementElement()) {
39685      composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
39686      composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
39687    }
39688    if (element.hasClaimResponse()) {
39689      composeReference("claimResponse", element.getClaimResponse());
39690    }
39691  }
39692
39693  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element)
39694      throws IOException {
39695    if (element != null) {
39696      open(name);
39697      composeClaimResponseErrorComponentInner(element);
39698      close();
39699    }
39700  }
39701
39702  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
39703    composeBackbone(element);
39704    if (element.hasItemSequenceElement()) {
39705      composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
39706      composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
39707    }
39708    if (element.hasDetailSequenceElement()) {
39709      composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
39710      composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
39711    }
39712    if (element.hasSubDetailSequenceElement()) {
39713      composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
39714      composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
39715    }
39716    if (element.hasCode()) {
39717      composeCodeableConcept("code", element.getCode());
39718    }
39719  }
39720
39721  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
39722    if (element != null) {
39723      prop("resourceType", name);
39724      composeClinicalImpressionInner(element);
39725    }
39726  }
39727
39728  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
39729    composeDomainResourceElements(element);
39730    if (element.hasIdentifier()) {
39731      openArray("identifier");
39732      for (Identifier e : element.getIdentifier())
39733        composeIdentifier(null, e);
39734      closeArray();
39735    }
39736    ;
39737    if (element.hasStatusElement()) {
39738      composeEnumerationCore("status", element.getStatusElement(),
39739          new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
39740      composeEnumerationExtras("status", element.getStatusElement(),
39741          new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
39742    }
39743    if (element.hasStatusReason()) {
39744      composeCodeableConcept("statusReason", element.getStatusReason());
39745    }
39746    if (element.hasCode()) {
39747      composeCodeableConcept("code", element.getCode());
39748    }
39749    if (element.hasDescriptionElement()) {
39750      composeStringCore("description", element.getDescriptionElement(), false);
39751      composeStringExtras("description", element.getDescriptionElement(), false);
39752    }
39753    if (element.hasSubject()) {
39754      composeReference("subject", element.getSubject());
39755    }
39756    if (element.hasEncounter()) {
39757      composeReference("encounter", element.getEncounter());
39758    }
39759    if (element.hasEffective()) {
39760      composeType("effective", element.getEffective());
39761    }
39762    if (element.hasDateElement()) {
39763      composeDateTimeCore("date", element.getDateElement(), false);
39764      composeDateTimeExtras("date", element.getDateElement(), false);
39765    }
39766    if (element.hasAssessor()) {
39767      composeReference("assessor", element.getAssessor());
39768    }
39769    if (element.hasPrevious()) {
39770      composeReference("previous", element.getPrevious());
39771    }
39772    if (element.hasProblem()) {
39773      openArray("problem");
39774      for (Reference e : element.getProblem())
39775        composeReference(null, e);
39776      closeArray();
39777    }
39778    ;
39779    if (element.hasInvestigation()) {
39780      openArray("investigation");
39781      for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation())
39782        composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
39783      closeArray();
39784    }
39785    ;
39786    if (element.hasProtocol()) {
39787      openArray("protocol");
39788      for (UriType e : element.getProtocol())
39789        composeUriCore(null, e, true);
39790      closeArray();
39791      if (anyHasExtras(element.getProtocol())) {
39792        openArray("_protocol");
39793        for (UriType e : element.getProtocol())
39794          composeUriExtras(null, e, true);
39795        closeArray();
39796      }
39797    }
39798    ;
39799    if (element.hasSummaryElement()) {
39800      composeStringCore("summary", element.getSummaryElement(), false);
39801      composeStringExtras("summary", element.getSummaryElement(), false);
39802    }
39803    if (element.hasFinding()) {
39804      openArray("finding");
39805      for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding())
39806        composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
39807      closeArray();
39808    }
39809    ;
39810    if (element.hasPrognosisCodeableConcept()) {
39811      openArray("prognosisCodeableConcept");
39812      for (CodeableConcept e : element.getPrognosisCodeableConcept())
39813        composeCodeableConcept(null, e);
39814      closeArray();
39815    }
39816    ;
39817    if (element.hasPrognosisReference()) {
39818      openArray("prognosisReference");
39819      for (Reference e : element.getPrognosisReference())
39820        composeReference(null, e);
39821      closeArray();
39822    }
39823    ;
39824    if (element.hasSupportingInfo()) {
39825      openArray("supportingInfo");
39826      for (Reference e : element.getSupportingInfo())
39827        composeReference(null, e);
39828      closeArray();
39829    }
39830    ;
39831    if (element.hasNote()) {
39832      openArray("note");
39833      for (Annotation e : element.getNote())
39834        composeAnnotation(null, e);
39835      closeArray();
39836    }
39837    ;
39838  }
39839
39840  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name,
39841      ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
39842    if (element != null) {
39843      open(name);
39844      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
39845      close();
39846    }
39847  }
39848
39849  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(
39850      ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
39851    composeBackbone(element);
39852    if (element.hasCode()) {
39853      composeCodeableConcept("code", element.getCode());
39854    }
39855    if (element.hasItem()) {
39856      openArray("item");
39857      for (Reference e : element.getItem())
39858        composeReference(null, e);
39859      closeArray();
39860    }
39861    ;
39862  }
39863
39864  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name,
39865      ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
39866    if (element != null) {
39867      open(name);
39868      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
39869      close();
39870    }
39871  }
39872
39873  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(
39874      ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
39875    composeBackbone(element);
39876    if (element.hasItemCodeableConcept()) {
39877      composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
39878    }
39879    if (element.hasItemReference()) {
39880      composeReference("itemReference", element.getItemReference());
39881    }
39882    if (element.hasBasisElement()) {
39883      composeStringCore("basis", element.getBasisElement(), false);
39884      composeStringExtras("basis", element.getBasisElement(), false);
39885    }
39886  }
39887
39888  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
39889    if (element != null) {
39890      prop("resourceType", name);
39891      composeCodeSystemInner(element);
39892    }
39893  }
39894
39895  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
39896    composeDomainResourceElements(element);
39897    if (element.hasUrlElement()) {
39898      composeUriCore("url", element.getUrlElement(), false);
39899      composeUriExtras("url", element.getUrlElement(), false);
39900    }
39901    if (element.hasIdentifier()) {
39902      openArray("identifier");
39903      for (Identifier e : element.getIdentifier())
39904        composeIdentifier(null, e);
39905      closeArray();
39906    }
39907    ;
39908    if (element.hasVersionElement()) {
39909      composeStringCore("version", element.getVersionElement(), false);
39910      composeStringExtras("version", element.getVersionElement(), false);
39911    }
39912    if (element.hasNameElement()) {
39913      composeStringCore("name", element.getNameElement(), false);
39914      composeStringExtras("name", element.getNameElement(), false);
39915    }
39916    if (element.hasTitleElement()) {
39917      composeStringCore("title", element.getTitleElement(), false);
39918      composeStringExtras("title", element.getTitleElement(), false);
39919    }
39920    if (element.hasStatusElement()) {
39921      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
39922          false);
39923      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
39924          false);
39925    }
39926    if (element.hasExperimentalElement()) {
39927      composeBooleanCore("experimental", element.getExperimentalElement(), false);
39928      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39929    }
39930    if (element.hasDateElement()) {
39931      composeDateTimeCore("date", element.getDateElement(), false);
39932      composeDateTimeExtras("date", element.getDateElement(), false);
39933    }
39934    if (element.hasPublisherElement()) {
39935      composeStringCore("publisher", element.getPublisherElement(), false);
39936      composeStringExtras("publisher", element.getPublisherElement(), false);
39937    }
39938    if (element.hasContact()) {
39939      openArray("contact");
39940      for (ContactDetail e : element.getContact())
39941        composeContactDetail(null, e);
39942      closeArray();
39943    }
39944    ;
39945    if (element.hasDescriptionElement()) {
39946      composeMarkdownCore("description", element.getDescriptionElement(), false);
39947      composeMarkdownExtras("description", element.getDescriptionElement(), false);
39948    }
39949    if (element.hasUseContext()) {
39950      openArray("useContext");
39951      for (UsageContext e : element.getUseContext())
39952        composeUsageContext(null, e);
39953      closeArray();
39954    }
39955    ;
39956    if (element.hasJurisdiction()) {
39957      openArray("jurisdiction");
39958      for (CodeableConcept e : element.getJurisdiction())
39959        composeCodeableConcept(null, e);
39960      closeArray();
39961    }
39962    ;
39963    if (element.hasPurposeElement()) {
39964      composeMarkdownCore("purpose", element.getPurposeElement(), false);
39965      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39966    }
39967    if (element.hasCopyrightElement()) {
39968      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39969      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39970    }
39971    if (element.hasCaseSensitiveElement()) {
39972      composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
39973      composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
39974    }
39975    if (element.hasValueSetElement()) {
39976      composeCanonicalCore("valueSet", element.getValueSetElement(), false);
39977      composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
39978    }
39979    if (element.hasHierarchyMeaningElement()) {
39980      composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(),
39981          new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
39982      composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(),
39983          new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
39984    }
39985    if (element.hasCompositionalElement()) {
39986      composeBooleanCore("compositional", element.getCompositionalElement(), false);
39987      composeBooleanExtras("compositional", element.getCompositionalElement(), false);
39988    }
39989    if (element.hasVersionNeededElement()) {
39990      composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
39991      composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
39992    }
39993    if (element.hasContentElement()) {
39994      composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(),
39995          false);
39996      composeEnumerationExtras("content", element.getContentElement(),
39997          new CodeSystem.CodeSystemContentModeEnumFactory(), false);
39998    }
39999    if (element.hasSupplementsElement()) {
40000      composeCanonicalCore("supplements", element.getSupplementsElement(), false);
40001      composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
40002    }
40003    if (element.hasCountElement()) {
40004      composeUnsignedIntCore("count", element.getCountElement(), false);
40005      composeUnsignedIntExtras("count", element.getCountElement(), false);
40006    }
40007    if (element.hasFilter()) {
40008      openArray("filter");
40009      for (CodeSystem.CodeSystemFilterComponent e : element.getFilter())
40010        composeCodeSystemCodeSystemFilterComponent(null, e);
40011      closeArray();
40012    }
40013    ;
40014    if (element.hasProperty()) {
40015      openArray("property");
40016      for (CodeSystem.PropertyComponent e : element.getProperty())
40017        composeCodeSystemPropertyComponent(null, e);
40018      closeArray();
40019    }
40020    ;
40021    if (element.hasConcept()) {
40022      openArray("concept");
40023      for (CodeSystem.ConceptDefinitionComponent e : element.getConcept())
40024        composeCodeSystemConceptDefinitionComponent(null, e);
40025      closeArray();
40026    }
40027    ;
40028  }
40029
40030  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element)
40031      throws IOException {
40032    if (element != null) {
40033      open(name);
40034      composeCodeSystemCodeSystemFilterComponentInner(element);
40035      close();
40036    }
40037  }
40038
40039  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element)
40040      throws IOException {
40041    composeBackbone(element);
40042    if (element.hasCodeElement()) {
40043      composeCodeCore("code", element.getCodeElement(), false);
40044      composeCodeExtras("code", element.getCodeElement(), false);
40045    }
40046    if (element.hasDescriptionElement()) {
40047      composeStringCore("description", element.getDescriptionElement(), false);
40048      composeStringExtras("description", element.getDescriptionElement(), false);
40049    }
40050    if (element.hasOperator()) {
40051      openArray("operator");
40052      for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator())
40053        composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
40054      closeArray();
40055      if (anyHasExtras(element.getOperator())) {
40056        openArray("_operator");
40057        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator())
40058          composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
40059        closeArray();
40060      }
40061    }
40062    ;
40063    if (element.hasValueElement()) {
40064      composeStringCore("value", element.getValueElement(), false);
40065      composeStringExtras("value", element.getValueElement(), false);
40066    }
40067  }
40068
40069  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element)
40070      throws IOException {
40071    if (element != null) {
40072      open(name);
40073      composeCodeSystemPropertyComponentInner(element);
40074      close();
40075    }
40076  }
40077
40078  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
40079    composeBackbone(element);
40080    if (element.hasCodeElement()) {
40081      composeCodeCore("code", element.getCodeElement(), false);
40082      composeCodeExtras("code", element.getCodeElement(), false);
40083    }
40084    if (element.hasUriElement()) {
40085      composeUriCore("uri", element.getUriElement(), false);
40086      composeUriExtras("uri", element.getUriElement(), false);
40087    }
40088    if (element.hasDescriptionElement()) {
40089      composeStringCore("description", element.getDescriptionElement(), false);
40090      composeStringExtras("description", element.getDescriptionElement(), false);
40091    }
40092    if (element.hasTypeElement()) {
40093      composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
40094      composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
40095    }
40096  }
40097
40098  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element)
40099      throws IOException {
40100    if (element != null) {
40101      open(name);
40102      composeCodeSystemConceptDefinitionComponentInner(element);
40103      close();
40104    }
40105  }
40106
40107  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element)
40108      throws IOException {
40109    composeBackbone(element);
40110    if (element.hasCodeElement()) {
40111      composeCodeCore("code", element.getCodeElement(), false);
40112      composeCodeExtras("code", element.getCodeElement(), false);
40113    }
40114    if (element.hasDisplayElement()) {
40115      composeStringCore("display", element.getDisplayElement(), false);
40116      composeStringExtras("display", element.getDisplayElement(), false);
40117    }
40118    if (element.hasDefinitionElement()) {
40119      composeStringCore("definition", element.getDefinitionElement(), false);
40120      composeStringExtras("definition", element.getDefinitionElement(), false);
40121    }
40122    if (element.hasDesignation()) {
40123      openArray("designation");
40124      for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation())
40125        composeCodeSystemConceptDefinitionDesignationComponent(null, e);
40126      closeArray();
40127    }
40128    ;
40129    if (element.hasProperty()) {
40130      openArray("property");
40131      for (CodeSystem.ConceptPropertyComponent e : element.getProperty())
40132        composeCodeSystemConceptPropertyComponent(null, e);
40133      closeArray();
40134    }
40135    ;
40136    if (element.hasConcept()) {
40137      openArray("concept");
40138      for (CodeSystem.ConceptDefinitionComponent e : element.getConcept())
40139        composeCodeSystemConceptDefinitionComponent(null, e);
40140      closeArray();
40141    }
40142    ;
40143  }
40144
40145  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name,
40146      CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
40147    if (element != null) {
40148      open(name);
40149      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
40150      close();
40151    }
40152  }
40153
40154  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(
40155      CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
40156    composeBackbone(element);
40157    if (element.hasLanguageElement()) {
40158      composeCodeCore("language", element.getLanguageElement(), false);
40159      composeCodeExtras("language", element.getLanguageElement(), false);
40160    }
40161    if (element.hasUse()) {
40162      composeCoding("use", element.getUse());
40163    }
40164    if (element.hasValueElement()) {
40165      composeStringCore("value", element.getValueElement(), false);
40166      composeStringExtras("value", element.getValueElement(), false);
40167    }
40168  }
40169
40170  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element)
40171      throws IOException {
40172    if (element != null) {
40173      open(name);
40174      composeCodeSystemConceptPropertyComponentInner(element);
40175      close();
40176    }
40177  }
40178
40179  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element)
40180      throws IOException {
40181    composeBackbone(element);
40182    if (element.hasCodeElement()) {
40183      composeCodeCore("code", element.getCodeElement(), false);
40184      composeCodeExtras("code", element.getCodeElement(), false);
40185    }
40186    if (element.hasValue()) {
40187      composeType("value", element.getValue());
40188    }
40189  }
40190
40191  protected void composeCommunication(String name, Communication element) throws IOException {
40192    if (element != null) {
40193      prop("resourceType", name);
40194      composeCommunicationInner(element);
40195    }
40196  }
40197
40198  protected void composeCommunicationInner(Communication element) throws IOException {
40199    composeDomainResourceElements(element);
40200    if (element.hasIdentifier()) {
40201      openArray("identifier");
40202      for (Identifier e : element.getIdentifier())
40203        composeIdentifier(null, e);
40204      closeArray();
40205    }
40206    ;
40207    if (element.hasInstantiatesCanonical()) {
40208      openArray("instantiatesCanonical");
40209      for (CanonicalType e : element.getInstantiatesCanonical())
40210        composeCanonicalCore(null, e, true);
40211      closeArray();
40212      if (anyHasExtras(element.getInstantiatesCanonical())) {
40213        openArray("_instantiatesCanonical");
40214        for (CanonicalType e : element.getInstantiatesCanonical())
40215          composeCanonicalExtras(null, e, true);
40216        closeArray();
40217      }
40218    }
40219    ;
40220    if (element.hasInstantiatesUri()) {
40221      openArray("instantiatesUri");
40222      for (UriType e : element.getInstantiatesUri())
40223        composeUriCore(null, e, true);
40224      closeArray();
40225      if (anyHasExtras(element.getInstantiatesUri())) {
40226        openArray("_instantiatesUri");
40227        for (UriType e : element.getInstantiatesUri())
40228          composeUriExtras(null, e, true);
40229        closeArray();
40230      }
40231    }
40232    ;
40233    if (element.hasBasedOn()) {
40234      openArray("basedOn");
40235      for (Reference e : element.getBasedOn())
40236        composeReference(null, e);
40237      closeArray();
40238    }
40239    ;
40240    if (element.hasPartOf()) {
40241      openArray("partOf");
40242      for (Reference e : element.getPartOf())
40243        composeReference(null, e);
40244      closeArray();
40245    }
40246    ;
40247    if (element.hasInResponseTo()) {
40248      openArray("inResponseTo");
40249      for (Reference e : element.getInResponseTo())
40250        composeReference(null, e);
40251      closeArray();
40252    }
40253    ;
40254    if (element.hasStatusElement()) {
40255      composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(),
40256          false);
40257      composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(),
40258          false);
40259    }
40260    if (element.hasStatusReason()) {
40261      composeCodeableConcept("statusReason", element.getStatusReason());
40262    }
40263    if (element.hasCategory()) {
40264      openArray("category");
40265      for (CodeableConcept e : element.getCategory())
40266        composeCodeableConcept(null, e);
40267      closeArray();
40268    }
40269    ;
40270    if (element.hasPriorityElement()) {
40271      composeEnumerationCore("priority", element.getPriorityElement(),
40272          new Communication.CommunicationPriorityEnumFactory(), false);
40273      composeEnumerationExtras("priority", element.getPriorityElement(),
40274          new Communication.CommunicationPriorityEnumFactory(), false);
40275    }
40276    if (element.hasMedium()) {
40277      openArray("medium");
40278      for (CodeableConcept e : element.getMedium())
40279        composeCodeableConcept(null, e);
40280      closeArray();
40281    }
40282    ;
40283    if (element.hasSubject()) {
40284      composeReference("subject", element.getSubject());
40285    }
40286    if (element.hasTopic()) {
40287      composeCodeableConcept("topic", element.getTopic());
40288    }
40289    if (element.hasAbout()) {
40290      openArray("about");
40291      for (Reference e : element.getAbout())
40292        composeReference(null, e);
40293      closeArray();
40294    }
40295    ;
40296    if (element.hasEncounter()) {
40297      composeReference("encounter", element.getEncounter());
40298    }
40299    if (element.hasSentElement()) {
40300      composeDateTimeCore("sent", element.getSentElement(), false);
40301      composeDateTimeExtras("sent", element.getSentElement(), false);
40302    }
40303    if (element.hasReceivedElement()) {
40304      composeDateTimeCore("received", element.getReceivedElement(), false);
40305      composeDateTimeExtras("received", element.getReceivedElement(), false);
40306    }
40307    if (element.hasRecipient()) {
40308      openArray("recipient");
40309      for (Reference e : element.getRecipient())
40310        composeReference(null, e);
40311      closeArray();
40312    }
40313    ;
40314    if (element.hasSender()) {
40315      composeReference("sender", element.getSender());
40316    }
40317    if (element.hasReasonCode()) {
40318      openArray("reasonCode");
40319      for (CodeableConcept e : element.getReasonCode())
40320        composeCodeableConcept(null, e);
40321      closeArray();
40322    }
40323    ;
40324    if (element.hasReasonReference()) {
40325      openArray("reasonReference");
40326      for (Reference e : element.getReasonReference())
40327        composeReference(null, e);
40328      closeArray();
40329    }
40330    ;
40331    if (element.hasPayload()) {
40332      openArray("payload");
40333      for (Communication.CommunicationPayloadComponent e : element.getPayload())
40334        composeCommunicationCommunicationPayloadComponent(null, e);
40335      closeArray();
40336    }
40337    ;
40338    if (element.hasNote()) {
40339      openArray("note");
40340      for (Annotation e : element.getNote())
40341        composeAnnotation(null, e);
40342      closeArray();
40343    }
40344    ;
40345  }
40346
40347  protected void composeCommunicationCommunicationPayloadComponent(String name,
40348      Communication.CommunicationPayloadComponent element) throws IOException {
40349    if (element != null) {
40350      open(name);
40351      composeCommunicationCommunicationPayloadComponentInner(element);
40352      close();
40353    }
40354  }
40355
40356  protected void composeCommunicationCommunicationPayloadComponentInner(
40357      Communication.CommunicationPayloadComponent element) throws IOException {
40358    composeBackbone(element);
40359    if (element.hasContent()) {
40360      composeType("content", element.getContent());
40361    }
40362  }
40363
40364  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
40365    if (element != null) {
40366      prop("resourceType", name);
40367      composeCommunicationRequestInner(element);
40368    }
40369  }
40370
40371  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
40372    composeDomainResourceElements(element);
40373    if (element.hasIdentifier()) {
40374      openArray("identifier");
40375      for (Identifier e : element.getIdentifier())
40376        composeIdentifier(null, e);
40377      closeArray();
40378    }
40379    ;
40380    if (element.hasBasedOn()) {
40381      openArray("basedOn");
40382      for (Reference e : element.getBasedOn())
40383        composeReference(null, e);
40384      closeArray();
40385    }
40386    ;
40387    if (element.hasReplaces()) {
40388      openArray("replaces");
40389      for (Reference e : element.getReplaces())
40390        composeReference(null, e);
40391      closeArray();
40392    }
40393    ;
40394    if (element.hasGroupIdentifier()) {
40395      composeIdentifier("groupIdentifier", element.getGroupIdentifier());
40396    }
40397    if (element.hasStatusElement()) {
40398      composeEnumerationCore("status", element.getStatusElement(),
40399          new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
40400      composeEnumerationExtras("status", element.getStatusElement(),
40401          new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
40402    }
40403    if (element.hasStatusReason()) {
40404      composeCodeableConcept("statusReason", element.getStatusReason());
40405    }
40406    if (element.hasCategory()) {
40407      openArray("category");
40408      for (CodeableConcept e : element.getCategory())
40409        composeCodeableConcept(null, e);
40410      closeArray();
40411    }
40412    ;
40413    if (element.hasPriorityElement()) {
40414      composeEnumerationCore("priority", element.getPriorityElement(),
40415          new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
40416      composeEnumerationExtras("priority", element.getPriorityElement(),
40417          new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
40418    }
40419    if (element.hasDoNotPerformElement()) {
40420      composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
40421      composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
40422    }
40423    if (element.hasMedium()) {
40424      openArray("medium");
40425      for (CodeableConcept e : element.getMedium())
40426        composeCodeableConcept(null, e);
40427      closeArray();
40428    }
40429    ;
40430    if (element.hasSubject()) {
40431      composeReference("subject", element.getSubject());
40432    }
40433    if (element.hasAbout()) {
40434      openArray("about");
40435      for (Reference e : element.getAbout())
40436        composeReference(null, e);
40437      closeArray();
40438    }
40439    ;
40440    if (element.hasEncounter()) {
40441      composeReference("encounter", element.getEncounter());
40442    }
40443    if (element.hasPayload()) {
40444      openArray("payload");
40445      for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload())
40446        composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
40447      closeArray();
40448    }
40449    ;
40450    if (element.hasOccurrence()) {
40451      composeType("occurrence", element.getOccurrence());
40452    }
40453    if (element.hasAuthoredOnElement()) {
40454      composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
40455      composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
40456    }
40457    if (element.hasRequester()) {
40458      composeReference("requester", element.getRequester());
40459    }
40460    if (element.hasRecipient()) {
40461      openArray("recipient");
40462      for (Reference e : element.getRecipient())
40463        composeReference(null, e);
40464      closeArray();
40465    }
40466    ;
40467    if (element.hasSender()) {
40468      composeReference("sender", element.getSender());
40469    }
40470    if (element.hasReasonCode()) {
40471      openArray("reasonCode");
40472      for (CodeableConcept e : element.getReasonCode())
40473        composeCodeableConcept(null, e);
40474      closeArray();
40475    }
40476    ;
40477    if (element.hasReasonReference()) {
40478      openArray("reasonReference");
40479      for (Reference e : element.getReasonReference())
40480        composeReference(null, e);
40481      closeArray();
40482    }
40483    ;
40484    if (element.hasNote()) {
40485      openArray("note");
40486      for (Annotation e : element.getNote())
40487        composeAnnotation(null, e);
40488      closeArray();
40489    }
40490    ;
40491  }
40492
40493  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name,
40494      CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
40495    if (element != null) {
40496      open(name);
40497      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
40498      close();
40499    }
40500  }
40501
40502  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(
40503      CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
40504    composeBackbone(element);
40505    if (element.hasContent()) {
40506      composeType("content", element.getContent());
40507    }
40508  }
40509
40510  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
40511    if (element != null) {
40512      prop("resourceType", name);
40513      composeCompartmentDefinitionInner(element);
40514    }
40515  }
40516
40517  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
40518    composeDomainResourceElements(element);
40519    if (element.hasUrlElement()) {
40520      composeUriCore("url", element.getUrlElement(), false);
40521      composeUriExtras("url", element.getUrlElement(), false);
40522    }
40523    if (element.hasVersionElement()) {
40524      composeStringCore("version", element.getVersionElement(), false);
40525      composeStringExtras("version", element.getVersionElement(), false);
40526    }
40527    if (element.hasNameElement()) {
40528      composeStringCore("name", element.getNameElement(), false);
40529      composeStringExtras("name", element.getNameElement(), false);
40530    }
40531    if (element.hasStatusElement()) {
40532      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
40533          false);
40534      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
40535          false);
40536    }
40537    if (element.hasExperimentalElement()) {
40538      composeBooleanCore("experimental", element.getExperimentalElement(), false);
40539      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40540    }
40541    if (element.hasDateElement()) {
40542      composeDateTimeCore("date", element.getDateElement(), false);
40543      composeDateTimeExtras("date", element.getDateElement(), false);
40544    }
40545    if (element.hasPublisherElement()) {
40546      composeStringCore("publisher", element.getPublisherElement(), false);
40547      composeStringExtras("publisher", element.getPublisherElement(), false);
40548    }
40549    if (element.hasContact()) {
40550      openArray("contact");
40551      for (ContactDetail e : element.getContact())
40552        composeContactDetail(null, e);
40553      closeArray();
40554    }
40555    ;
40556    if (element.hasDescriptionElement()) {
40557      composeMarkdownCore("description", element.getDescriptionElement(), false);
40558      composeMarkdownExtras("description", element.getDescriptionElement(), false);
40559    }
40560    if (element.hasUseContext()) {
40561      openArray("useContext");
40562      for (UsageContext e : element.getUseContext())
40563        composeUsageContext(null, e);
40564      closeArray();
40565    }
40566    ;
40567    if (element.hasPurposeElement()) {
40568      composeMarkdownCore("purpose", element.getPurposeElement(), false);
40569      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40570    }
40571    if (element.hasCodeElement()) {
40572      composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(),
40573          false);
40574      composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(),
40575          false);
40576    }
40577    if (element.hasSearchElement()) {
40578      composeBooleanCore("search", element.getSearchElement(), false);
40579      composeBooleanExtras("search", element.getSearchElement(), false);
40580    }
40581    if (element.hasResource()) {
40582      openArray("resource");
40583      for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource())
40584        composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
40585      closeArray();
40586    }
40587    ;
40588  }
40589
40590  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name,
40591      CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
40592    if (element != null) {
40593      open(name);
40594      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
40595      close();
40596    }
40597  }
40598
40599  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(
40600      CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
40601    composeBackbone(element);
40602    if (element.hasCodeElement()) {
40603      composeCodeCore("code", element.getCodeElement(), false);
40604      composeCodeExtras("code", element.getCodeElement(), false);
40605    }
40606    if (element.hasParam()) {
40607      openArray("param");
40608      for (StringType e : element.getParam())
40609        composeStringCore(null, e, true);
40610      closeArray();
40611      if (anyHasExtras(element.getParam())) {
40612        openArray("_param");
40613        for (StringType e : element.getParam())
40614          composeStringExtras(null, e, true);
40615        closeArray();
40616      }
40617    }
40618    ;
40619    if (element.hasDocumentationElement()) {
40620      composeStringCore("documentation", element.getDocumentationElement(), false);
40621      composeStringExtras("documentation", element.getDocumentationElement(), false);
40622    }
40623  }
40624
40625  protected void composeComposition(String name, Composition element) throws IOException {
40626    if (element != null) {
40627      prop("resourceType", name);
40628      composeCompositionInner(element);
40629    }
40630  }
40631
40632  protected void composeCompositionInner(Composition element) throws IOException {
40633    composeDomainResourceElements(element);
40634    if (element.hasIdentifier()) {
40635      composeIdentifier("identifier", element.getIdentifier());
40636    }
40637    if (element.hasStatusElement()) {
40638      composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(),
40639          false);
40640      composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(),
40641          false);
40642    }
40643    if (element.hasType()) {
40644      composeCodeableConcept("type", element.getType());
40645    }
40646    if (element.hasCategory()) {
40647      openArray("category");
40648      for (CodeableConcept e : element.getCategory())
40649        composeCodeableConcept(null, e);
40650      closeArray();
40651    }
40652    ;
40653    if (element.hasSubject()) {
40654      composeReference("subject", element.getSubject());
40655    }
40656    if (element.hasEncounter()) {
40657      composeReference("encounter", element.getEncounter());
40658    }
40659    if (element.hasDateElement()) {
40660      composeDateTimeCore("date", element.getDateElement(), false);
40661      composeDateTimeExtras("date", element.getDateElement(), false);
40662    }
40663    if (element.hasAuthor()) {
40664      openArray("author");
40665      for (Reference e : element.getAuthor())
40666        composeReference(null, e);
40667      closeArray();
40668    }
40669    ;
40670    if (element.hasTitleElement()) {
40671      composeStringCore("title", element.getTitleElement(), false);
40672      composeStringExtras("title", element.getTitleElement(), false);
40673    }
40674    if (element.hasConfidentialityElement()) {
40675      composeEnumerationCore("confidentiality", element.getConfidentialityElement(),
40676          new Composition.DocumentConfidentialityEnumFactory(), false);
40677      composeEnumerationExtras("confidentiality", element.getConfidentialityElement(),
40678          new Composition.DocumentConfidentialityEnumFactory(), false);
40679    }
40680    if (element.hasAttester()) {
40681      openArray("attester");
40682      for (Composition.CompositionAttesterComponent e : element.getAttester())
40683        composeCompositionCompositionAttesterComponent(null, e);
40684      closeArray();
40685    }
40686    ;
40687    if (element.hasCustodian()) {
40688      composeReference("custodian", element.getCustodian());
40689    }
40690    if (element.hasRelatesTo()) {
40691      openArray("relatesTo");
40692      for (Composition.CompositionRelatesToComponent e : element.getRelatesTo())
40693        composeCompositionCompositionRelatesToComponent(null, e);
40694      closeArray();
40695    }
40696    ;
40697    if (element.hasEvent()) {
40698      openArray("event");
40699      for (Composition.CompositionEventComponent e : element.getEvent())
40700        composeCompositionCompositionEventComponent(null, e);
40701      closeArray();
40702    }
40703    ;
40704    if (element.hasSection()) {
40705      openArray("section");
40706      for (Composition.SectionComponent e : element.getSection())
40707        composeCompositionSectionComponent(null, e);
40708      closeArray();
40709    }
40710    ;
40711  }
40712
40713  protected void composeCompositionCompositionAttesterComponent(String name,
40714      Composition.CompositionAttesterComponent element) throws IOException {
40715    if (element != null) {
40716      open(name);
40717      composeCompositionCompositionAttesterComponentInner(element);
40718      close();
40719    }
40720  }
40721
40722  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element)
40723      throws IOException {
40724    composeBackbone(element);
40725    if (element.hasModeElement()) {
40726      composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(),
40727          false);
40728      composeEnumerationExtras("mode", element.getModeElement(),
40729          new Composition.CompositionAttestationModeEnumFactory(), false);
40730    }
40731    if (element.hasTimeElement()) {
40732      composeDateTimeCore("time", element.getTimeElement(), false);
40733      composeDateTimeExtras("time", element.getTimeElement(), false);
40734    }
40735    if (element.hasParty()) {
40736      composeReference("party", element.getParty());
40737    }
40738  }
40739
40740  protected void composeCompositionCompositionRelatesToComponent(String name,
40741      Composition.CompositionRelatesToComponent element) throws IOException {
40742    if (element != null) {
40743      open(name);
40744      composeCompositionCompositionRelatesToComponentInner(element);
40745      close();
40746    }
40747  }
40748
40749  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element)
40750      throws IOException {
40751    composeBackbone(element);
40752    if (element.hasCodeElement()) {
40753      composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(),
40754          false);
40755      composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(),
40756          false);
40757    }
40758    if (element.hasTarget()) {
40759      composeType("target", element.getTarget());
40760    }
40761  }
40762
40763  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element)
40764      throws IOException {
40765    if (element != null) {
40766      open(name);
40767      composeCompositionCompositionEventComponentInner(element);
40768      close();
40769    }
40770  }
40771
40772  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element)
40773      throws IOException {
40774    composeBackbone(element);
40775    if (element.hasCode()) {
40776      openArray("code");
40777      for (CodeableConcept e : element.getCode())
40778        composeCodeableConcept(null, e);
40779      closeArray();
40780    }
40781    ;
40782    if (element.hasPeriod()) {
40783      composePeriod("period", element.getPeriod());
40784    }
40785    if (element.hasDetail()) {
40786      openArray("detail");
40787      for (Reference e : element.getDetail())
40788        composeReference(null, e);
40789      closeArray();
40790    }
40791    ;
40792  }
40793
40794  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element)
40795      throws IOException {
40796    if (element != null) {
40797      open(name);
40798      composeCompositionSectionComponentInner(element);
40799      close();
40800    }
40801  }
40802
40803  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
40804    composeBackbone(element);
40805    if (element.hasTitleElement()) {
40806      composeStringCore("title", element.getTitleElement(), false);
40807      composeStringExtras("title", element.getTitleElement(), false);
40808    }
40809    if (element.hasCode()) {
40810      composeCodeableConcept("code", element.getCode());
40811    }
40812    if (element.hasAuthor()) {
40813      openArray("author");
40814      for (Reference e : element.getAuthor())
40815        composeReference(null, e);
40816      closeArray();
40817    }
40818    ;
40819    if (element.hasFocus()) {
40820      composeReference("focus", element.getFocus());
40821    }
40822    if (element.hasText()) {
40823      composeNarrative("text", element.getText());
40824    }
40825    if (element.hasModeElement()) {
40826      composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
40827      composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
40828    }
40829    if (element.hasOrderedBy()) {
40830      composeCodeableConcept("orderedBy", element.getOrderedBy());
40831    }
40832    if (element.hasEntry()) {
40833      openArray("entry");
40834      for (Reference e : element.getEntry())
40835        composeReference(null, e);
40836      closeArray();
40837    }
40838    ;
40839    if (element.hasEmptyReason()) {
40840      composeCodeableConcept("emptyReason", element.getEmptyReason());
40841    }
40842    if (element.hasSection()) {
40843      openArray("section");
40844      for (Composition.SectionComponent e : element.getSection())
40845        composeCompositionSectionComponent(null, e);
40846      closeArray();
40847    }
40848    ;
40849  }
40850
40851  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
40852    if (element != null) {
40853      prop("resourceType", name);
40854      composeConceptMapInner(element);
40855    }
40856  }
40857
40858  protected void composeConceptMapInner(ConceptMap element) throws IOException {
40859    composeDomainResourceElements(element);
40860    if (element.hasUrlElement()) {
40861      composeUriCore("url", element.getUrlElement(), false);
40862      composeUriExtras("url", element.getUrlElement(), false);
40863    }
40864    if (element.hasIdentifier()) {
40865      composeIdentifier("identifier", element.getIdentifier());
40866    }
40867    if (element.hasVersionElement()) {
40868      composeStringCore("version", element.getVersionElement(), false);
40869      composeStringExtras("version", element.getVersionElement(), false);
40870    }
40871    if (element.hasNameElement()) {
40872      composeStringCore("name", element.getNameElement(), false);
40873      composeStringExtras("name", element.getNameElement(), false);
40874    }
40875    if (element.hasTitleElement()) {
40876      composeStringCore("title", element.getTitleElement(), false);
40877      composeStringExtras("title", element.getTitleElement(), false);
40878    }
40879    if (element.hasStatusElement()) {
40880      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
40881          false);
40882      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
40883          false);
40884    }
40885    if (element.hasExperimentalElement()) {
40886      composeBooleanCore("experimental", element.getExperimentalElement(), false);
40887      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40888    }
40889    if (element.hasDateElement()) {
40890      composeDateTimeCore("date", element.getDateElement(), false);
40891      composeDateTimeExtras("date", element.getDateElement(), false);
40892    }
40893    if (element.hasPublisherElement()) {
40894      composeStringCore("publisher", element.getPublisherElement(), false);
40895      composeStringExtras("publisher", element.getPublisherElement(), false);
40896    }
40897    if (element.hasContact()) {
40898      openArray("contact");
40899      for (ContactDetail e : element.getContact())
40900        composeContactDetail(null, e);
40901      closeArray();
40902    }
40903    ;
40904    if (element.hasDescriptionElement()) {
40905      composeMarkdownCore("description", element.getDescriptionElement(), false);
40906      composeMarkdownExtras("description", element.getDescriptionElement(), false);
40907    }
40908    if (element.hasUseContext()) {
40909      openArray("useContext");
40910      for (UsageContext e : element.getUseContext())
40911        composeUsageContext(null, e);
40912      closeArray();
40913    }
40914    ;
40915    if (element.hasJurisdiction()) {
40916      openArray("jurisdiction");
40917      for (CodeableConcept e : element.getJurisdiction())
40918        composeCodeableConcept(null, e);
40919      closeArray();
40920    }
40921    ;
40922    if (element.hasPurposeElement()) {
40923      composeMarkdownCore("purpose", element.getPurposeElement(), false);
40924      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40925    }
40926    if (element.hasCopyrightElement()) {
40927      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40928      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40929    }
40930    if (element.hasSource()) {
40931      composeType("source", element.getSource());
40932    }
40933    if (element.hasTarget()) {
40934      composeType("target", element.getTarget());
40935    }
40936    if (element.hasGroup()) {
40937      openArray("group");
40938      for (ConceptMap.ConceptMapGroupComponent e : element.getGroup())
40939        composeConceptMapConceptMapGroupComponent(null, e);
40940      closeArray();
40941    }
40942    ;
40943  }
40944
40945  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element)
40946      throws IOException {
40947    if (element != null) {
40948      open(name);
40949      composeConceptMapConceptMapGroupComponentInner(element);
40950      close();
40951    }
40952  }
40953
40954  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element)
40955      throws IOException {
40956    composeBackbone(element);
40957    if (element.hasSourceElement()) {
40958      composeUriCore("source", element.getSourceElement(), false);
40959      composeUriExtras("source", element.getSourceElement(), false);
40960    }
40961    if (element.hasSourceVersionElement()) {
40962      composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
40963      composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
40964    }
40965    if (element.hasTargetElement()) {
40966      composeUriCore("target", element.getTargetElement(), false);
40967      composeUriExtras("target", element.getTargetElement(), false);
40968    }
40969    if (element.hasTargetVersionElement()) {
40970      composeStringCore("targetVersion", element.getTargetVersionElement(), false);
40971      composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
40972    }
40973    if (element.hasElement()) {
40974      openArray("element");
40975      for (ConceptMap.SourceElementComponent e : element.getElement())
40976        composeConceptMapSourceElementComponent(null, e);
40977      closeArray();
40978    }
40979    ;
40980    if (element.hasUnmapped()) {
40981      composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
40982    }
40983  }
40984
40985  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element)
40986      throws IOException {
40987    if (element != null) {
40988      open(name);
40989      composeConceptMapSourceElementComponentInner(element);
40990      close();
40991    }
40992  }
40993
40994  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element)
40995      throws IOException {
40996    composeBackbone(element);
40997    if (element.hasCodeElement()) {
40998      composeCodeCore("code", element.getCodeElement(), false);
40999      composeCodeExtras("code", element.getCodeElement(), false);
41000    }
41001    if (element.hasDisplayElement()) {
41002      composeStringCore("display", element.getDisplayElement(), false);
41003      composeStringExtras("display", element.getDisplayElement(), false);
41004    }
41005    if (element.hasTarget()) {
41006      openArray("target");
41007      for (ConceptMap.TargetElementComponent e : element.getTarget())
41008        composeConceptMapTargetElementComponent(null, e);
41009      closeArray();
41010    }
41011    ;
41012  }
41013
41014  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element)
41015      throws IOException {
41016    if (element != null) {
41017      open(name);
41018      composeConceptMapTargetElementComponentInner(element);
41019      close();
41020    }
41021  }
41022
41023  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element)
41024      throws IOException {
41025    composeBackbone(element);
41026    if (element.hasCodeElement()) {
41027      composeCodeCore("code", element.getCodeElement(), false);
41028      composeCodeExtras("code", element.getCodeElement(), false);
41029    }
41030    if (element.hasDisplayElement()) {
41031      composeStringCore("display", element.getDisplayElement(), false);
41032      composeStringExtras("display", element.getDisplayElement(), false);
41033    }
41034    if (element.hasEquivalenceElement()) {
41035      composeEnumerationCore("equivalence", element.getEquivalenceElement(),
41036          new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
41037      composeEnumerationExtras("equivalence", element.getEquivalenceElement(),
41038          new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
41039    }
41040    if (element.hasCommentElement()) {
41041      composeStringCore("comment", element.getCommentElement(), false);
41042      composeStringExtras("comment", element.getCommentElement(), false);
41043    }
41044    if (element.hasDependsOn()) {
41045      openArray("dependsOn");
41046      for (ConceptMap.OtherElementComponent e : element.getDependsOn())
41047        composeConceptMapOtherElementComponent(null, e);
41048      closeArray();
41049    }
41050    ;
41051    if (element.hasProduct()) {
41052      openArray("product");
41053      for (ConceptMap.OtherElementComponent e : element.getProduct())
41054        composeConceptMapOtherElementComponent(null, e);
41055      closeArray();
41056    }
41057    ;
41058  }
41059
41060  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element)
41061      throws IOException {
41062    if (element != null) {
41063      open(name);
41064      composeConceptMapOtherElementComponentInner(element);
41065      close();
41066    }
41067  }
41068
41069  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element)
41070      throws IOException {
41071    composeBackbone(element);
41072    if (element.hasPropertyElement()) {
41073      composeUriCore("property", element.getPropertyElement(), false);
41074      composeUriExtras("property", element.getPropertyElement(), false);
41075    }
41076    if (element.hasSystemElement()) {
41077      composeCanonicalCore("system", element.getSystemElement(), false);
41078      composeCanonicalExtras("system", element.getSystemElement(), false);
41079    }
41080    if (element.hasValueElement()) {
41081      composeStringCore("value", element.getValueElement(), false);
41082      composeStringExtras("value", element.getValueElement(), false);
41083    }
41084    if (element.hasDisplayElement()) {
41085      composeStringCore("display", element.getDisplayElement(), false);
41086      composeStringExtras("display", element.getDisplayElement(), false);
41087    }
41088  }
41089
41090  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name,
41091      ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
41092    if (element != null) {
41093      open(name);
41094      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
41095      close();
41096    }
41097  }
41098
41099  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(
41100      ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
41101    composeBackbone(element);
41102    if (element.hasModeElement()) {
41103      composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(),
41104          false);
41105      composeEnumerationExtras("mode", element.getModeElement(),
41106          new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
41107    }
41108    if (element.hasCodeElement()) {
41109      composeCodeCore("code", element.getCodeElement(), false);
41110      composeCodeExtras("code", element.getCodeElement(), false);
41111    }
41112    if (element.hasDisplayElement()) {
41113      composeStringCore("display", element.getDisplayElement(), false);
41114      composeStringExtras("display", element.getDisplayElement(), false);
41115    }
41116    if (element.hasUrlElement()) {
41117      composeCanonicalCore("url", element.getUrlElement(), false);
41118      composeCanonicalExtras("url", element.getUrlElement(), false);
41119    }
41120  }
41121
41122  protected void composeCondition(String name, Condition element) throws IOException {
41123    if (element != null) {
41124      prop("resourceType", name);
41125      composeConditionInner(element);
41126    }
41127  }
41128
41129  protected void composeConditionInner(Condition element) throws IOException {
41130    composeDomainResourceElements(element);
41131    if (element.hasIdentifier()) {
41132      openArray("identifier");
41133      for (Identifier e : element.getIdentifier())
41134        composeIdentifier(null, e);
41135      closeArray();
41136    }
41137    ;
41138    if (element.hasClinicalStatus()) {
41139      composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
41140    }
41141    if (element.hasVerificationStatus()) {
41142      composeCodeableConcept("verificationStatus", element.getVerificationStatus());
41143    }
41144    if (element.hasCategory()) {
41145      openArray("category");
41146      for (CodeableConcept e : element.getCategory())
41147        composeCodeableConcept(null, e);
41148      closeArray();
41149    }
41150    ;
41151    if (element.hasSeverity()) {
41152      composeCodeableConcept("severity", element.getSeverity());
41153    }
41154    if (element.hasCode()) {
41155      composeCodeableConcept("code", element.getCode());
41156    }
41157    if (element.hasBodySite()) {
41158      openArray("bodySite");
41159      for (CodeableConcept e : element.getBodySite())
41160        composeCodeableConcept(null, e);
41161      closeArray();
41162    }
41163    ;
41164    if (element.hasSubject()) {
41165      composeReference("subject", element.getSubject());
41166    }
41167    if (element.hasEncounter()) {
41168      composeReference("encounter", element.getEncounter());
41169    }
41170    if (element.hasOnset()) {
41171      composeType("onset", element.getOnset());
41172    }
41173    if (element.hasAbatement()) {
41174      composeType("abatement", element.getAbatement());
41175    }
41176    if (element.hasRecordedDateElement()) {
41177      composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
41178      composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
41179    }
41180    if (element.hasRecorder()) {
41181      composeReference("recorder", element.getRecorder());
41182    }
41183    if (element.hasAsserter()) {
41184      composeReference("asserter", element.getAsserter());
41185    }
41186    if (element.hasStage()) {
41187      openArray("stage");
41188      for (Condition.ConditionStageComponent e : element.getStage())
41189        composeConditionConditionStageComponent(null, e);
41190      closeArray();
41191    }
41192    ;
41193    if (element.hasEvidence()) {
41194      openArray("evidence");
41195      for (Condition.ConditionEvidenceComponent e : element.getEvidence())
41196        composeConditionConditionEvidenceComponent(null, e);
41197      closeArray();
41198    }
41199    ;
41200    if (element.hasNote()) {
41201      openArray("note");
41202      for (Annotation e : element.getNote())
41203        composeAnnotation(null, e);
41204      closeArray();
41205    }
41206    ;
41207  }
41208
41209  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element)
41210      throws IOException {
41211    if (element != null) {
41212      open(name);
41213      composeConditionConditionStageComponentInner(element);
41214      close();
41215    }
41216  }
41217
41218  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element)
41219      throws IOException {
41220    composeBackbone(element);
41221    if (element.hasSummary()) {
41222      composeCodeableConcept("summary", element.getSummary());
41223    }
41224    if (element.hasAssessment()) {
41225      openArray("assessment");
41226      for (Reference e : element.getAssessment())
41227        composeReference(null, e);
41228      closeArray();
41229    }
41230    ;
41231    if (element.hasType()) {
41232      composeCodeableConcept("type", element.getType());
41233    }
41234  }
41235
41236  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element)
41237      throws IOException {
41238    if (element != null) {
41239      open(name);
41240      composeConditionConditionEvidenceComponentInner(element);
41241      close();
41242    }
41243  }
41244
41245  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element)
41246      throws IOException {
41247    composeBackbone(element);
41248    if (element.hasCode()) {
41249      openArray("code");
41250      for (CodeableConcept e : element.getCode())
41251        composeCodeableConcept(null, e);
41252      closeArray();
41253    }
41254    ;
41255    if (element.hasDetail()) {
41256      openArray("detail");
41257      for (Reference e : element.getDetail())
41258        composeReference(null, e);
41259      closeArray();
41260    }
41261    ;
41262  }
41263
41264  protected void composeConsent(String name, Consent element) throws IOException {
41265    if (element != null) {
41266      prop("resourceType", name);
41267      composeConsentInner(element);
41268    }
41269  }
41270
41271  protected void composeConsentInner(Consent element) throws IOException {
41272    composeDomainResourceElements(element);
41273    if (element.hasIdentifier()) {
41274      openArray("identifier");
41275      for (Identifier e : element.getIdentifier())
41276        composeIdentifier(null, e);
41277      closeArray();
41278    }
41279    ;
41280    if (element.hasStatusElement()) {
41281      composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
41282      composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
41283    }
41284    if (element.hasScope()) {
41285      composeCodeableConcept("scope", element.getScope());
41286    }
41287    if (element.hasCategory()) {
41288      openArray("category");
41289      for (CodeableConcept e : element.getCategory())
41290        composeCodeableConcept(null, e);
41291      closeArray();
41292    }
41293    ;
41294    if (element.hasPatient()) {
41295      composeReference("patient", element.getPatient());
41296    }
41297    if (element.hasDateTimeElement()) {
41298      composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
41299      composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
41300    }
41301    if (element.hasPerformer()) {
41302      openArray("performer");
41303      for (Reference e : element.getPerformer())
41304        composeReference(null, e);
41305      closeArray();
41306    }
41307    ;
41308    if (element.hasOrganization()) {
41309      openArray("organization");
41310      for (Reference e : element.getOrganization())
41311        composeReference(null, e);
41312      closeArray();
41313    }
41314    ;
41315    if (element.hasSource()) {
41316      composeType("source", element.getSource());
41317    }
41318    if (element.hasPolicy()) {
41319      openArray("policy");
41320      for (Consent.ConsentPolicyComponent e : element.getPolicy())
41321        composeConsentConsentPolicyComponent(null, e);
41322      closeArray();
41323    }
41324    ;
41325    if (element.hasPolicyRule()) {
41326      composeCodeableConcept("policyRule", element.getPolicyRule());
41327    }
41328    if (element.hasVerification()) {
41329      openArray("verification");
41330      for (Consent.ConsentVerificationComponent e : element.getVerification())
41331        composeConsentConsentVerificationComponent(null, e);
41332      closeArray();
41333    }
41334    ;
41335    if (element.hasProvision()) {
41336      composeConsentprovisionComponent("provision", element.getProvision());
41337    }
41338  }
41339
41340  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element)
41341      throws IOException {
41342    if (element != null) {
41343      open(name);
41344      composeConsentConsentPolicyComponentInner(element);
41345      close();
41346    }
41347  }
41348
41349  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
41350    composeBackbone(element);
41351    if (element.hasAuthorityElement()) {
41352      composeUriCore("authority", element.getAuthorityElement(), false);
41353      composeUriExtras("authority", element.getAuthorityElement(), false);
41354    }
41355    if (element.hasUriElement()) {
41356      composeUriCore("uri", element.getUriElement(), false);
41357      composeUriExtras("uri", element.getUriElement(), false);
41358    }
41359  }
41360
41361  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element)
41362      throws IOException {
41363    if (element != null) {
41364      open(name);
41365      composeConsentConsentVerificationComponentInner(element);
41366      close();
41367    }
41368  }
41369
41370  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element)
41371      throws IOException {
41372    composeBackbone(element);
41373    if (element.hasVerifiedElement()) {
41374      composeBooleanCore("verified", element.getVerifiedElement(), false);
41375      composeBooleanExtras("verified", element.getVerifiedElement(), false);
41376    }
41377    if (element.hasVerifiedWith()) {
41378      composeReference("verifiedWith", element.getVerifiedWith());
41379    }
41380    if (element.hasVerificationDateElement()) {
41381      composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
41382      composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
41383    }
41384  }
41385
41386  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
41387    if (element != null) {
41388      open(name);
41389      composeConsentprovisionComponentInner(element);
41390      close();
41391    }
41392  }
41393
41394  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
41395    composeBackbone(element);
41396    if (element.hasTypeElement()) {
41397      composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
41398      composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
41399    }
41400    if (element.hasPeriod()) {
41401      composePeriod("period", element.getPeriod());
41402    }
41403    if (element.hasActor()) {
41404      openArray("actor");
41405      for (Consent.provisionActorComponent e : element.getActor())
41406        composeConsentprovisionActorComponent(null, e);
41407      closeArray();
41408    }
41409    ;
41410    if (element.hasAction()) {
41411      openArray("action");
41412      for (CodeableConcept e : element.getAction())
41413        composeCodeableConcept(null, e);
41414      closeArray();
41415    }
41416    ;
41417    if (element.hasSecurityLabel()) {
41418      openArray("securityLabel");
41419      for (Coding e : element.getSecurityLabel())
41420        composeCoding(null, e);
41421      closeArray();
41422    }
41423    ;
41424    if (element.hasPurpose()) {
41425      openArray("purpose");
41426      for (Coding e : element.getPurpose())
41427        composeCoding(null, e);
41428      closeArray();
41429    }
41430    ;
41431    if (element.hasClass_()) {
41432      openArray("class");
41433      for (Coding e : element.getClass_())
41434        composeCoding(null, e);
41435      closeArray();
41436    }
41437    ;
41438    if (element.hasCode()) {
41439      openArray("code");
41440      for (CodeableConcept e : element.getCode())
41441        composeCodeableConcept(null, e);
41442      closeArray();
41443    }
41444    ;
41445    if (element.hasDataPeriod()) {
41446      composePeriod("dataPeriod", element.getDataPeriod());
41447    }
41448    if (element.hasData()) {
41449      openArray("data");
41450      for (Consent.provisionDataComponent e : element.getData())
41451        composeConsentprovisionDataComponent(null, e);
41452      closeArray();
41453    }
41454    ;
41455    if (element.hasProvision()) {
41456      openArray("provision");
41457      for (Consent.provisionComponent e : element.getProvision())
41458        composeConsentprovisionComponent(null, e);
41459      closeArray();
41460    }
41461    ;
41462  }
41463
41464  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element)
41465      throws IOException {
41466    if (element != null) {
41467      open(name);
41468      composeConsentprovisionActorComponentInner(element);
41469      close();
41470    }
41471  }
41472
41473  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element)
41474      throws IOException {
41475    composeBackbone(element);
41476    if (element.hasRole()) {
41477      composeCodeableConcept("role", element.getRole());
41478    }
41479    if (element.hasReference()) {
41480      composeReference("reference", element.getReference());
41481    }
41482  }
41483
41484  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element)
41485      throws IOException {
41486    if (element != null) {
41487      open(name);
41488      composeConsentprovisionDataComponentInner(element);
41489      close();
41490    }
41491  }
41492
41493  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
41494    composeBackbone(element);
41495    if (element.hasMeaningElement()) {
41496      composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(),
41497          false);
41498      composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(),
41499          false);
41500    }
41501    if (element.hasReference()) {
41502      composeReference("reference", element.getReference());
41503    }
41504  }
41505
41506  protected void composeContract(String name, Contract element) throws IOException {
41507    if (element != null) {
41508      prop("resourceType", name);
41509      composeContractInner(element);
41510    }
41511  }
41512
41513  protected void composeContractInner(Contract element) throws IOException {
41514    composeDomainResourceElements(element);
41515    if (element.hasIdentifier()) {
41516      openArray("identifier");
41517      for (Identifier e : element.getIdentifier())
41518        composeIdentifier(null, e);
41519      closeArray();
41520    }
41521    ;
41522    if (element.hasUrlElement()) {
41523      composeUriCore("url", element.getUrlElement(), false);
41524      composeUriExtras("url", element.getUrlElement(), false);
41525    }
41526    if (element.hasVersionElement()) {
41527      composeStringCore("version", element.getVersionElement(), false);
41528      composeStringExtras("version", element.getVersionElement(), false);
41529    }
41530    if (element.hasStatusElement()) {
41531      composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
41532      composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
41533    }
41534    if (element.hasLegalState()) {
41535      composeCodeableConcept("legalState", element.getLegalState());
41536    }
41537    if (element.hasInstantiatesCanonical()) {
41538      composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
41539    }
41540    if (element.hasInstantiatesUriElement()) {
41541      composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
41542      composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
41543    }
41544    if (element.hasContentDerivative()) {
41545      composeCodeableConcept("contentDerivative", element.getContentDerivative());
41546    }
41547    if (element.hasIssuedElement()) {
41548      composeDateTimeCore("issued", element.getIssuedElement(), false);
41549      composeDateTimeExtras("issued", element.getIssuedElement(), false);
41550    }
41551    if (element.hasApplies()) {
41552      composePeriod("applies", element.getApplies());
41553    }
41554    if (element.hasExpirationType()) {
41555      composeCodeableConcept("expirationType", element.getExpirationType());
41556    }
41557    if (element.hasSubject()) {
41558      openArray("subject");
41559      for (Reference e : element.getSubject())
41560        composeReference(null, e);
41561      closeArray();
41562    }
41563    ;
41564    if (element.hasAuthority()) {
41565      openArray("authority");
41566      for (Reference e : element.getAuthority())
41567        composeReference(null, e);
41568      closeArray();
41569    }
41570    ;
41571    if (element.hasDomain()) {
41572      openArray("domain");
41573      for (Reference e : element.getDomain())
41574        composeReference(null, e);
41575      closeArray();
41576    }
41577    ;
41578    if (element.hasSite()) {
41579      openArray("site");
41580      for (Reference e : element.getSite())
41581        composeReference(null, e);
41582      closeArray();
41583    }
41584    ;
41585    if (element.hasNameElement()) {
41586      composeStringCore("name", element.getNameElement(), false);
41587      composeStringExtras("name", element.getNameElement(), false);
41588    }
41589    if (element.hasTitleElement()) {
41590      composeStringCore("title", element.getTitleElement(), false);
41591      composeStringExtras("title", element.getTitleElement(), false);
41592    }
41593    if (element.hasSubtitleElement()) {
41594      composeStringCore("subtitle", element.getSubtitleElement(), false);
41595      composeStringExtras("subtitle", element.getSubtitleElement(), false);
41596    }
41597    if (element.hasAlias()) {
41598      openArray("alias");
41599      for (StringType e : element.getAlias())
41600        composeStringCore(null, e, true);
41601      closeArray();
41602      if (anyHasExtras(element.getAlias())) {
41603        openArray("_alias");
41604        for (StringType e : element.getAlias())
41605          composeStringExtras(null, e, true);
41606        closeArray();
41607      }
41608    }
41609    ;
41610    if (element.hasAuthor()) {
41611      composeReference("author", element.getAuthor());
41612    }
41613    if (element.hasScope()) {
41614      composeCodeableConcept("scope", element.getScope());
41615    }
41616    if (element.hasTopic()) {
41617      composeType("topic", element.getTopic());
41618    }
41619    if (element.hasType()) {
41620      composeCodeableConcept("type", element.getType());
41621    }
41622    if (element.hasSubType()) {
41623      openArray("subType");
41624      for (CodeableConcept e : element.getSubType())
41625        composeCodeableConcept(null, e);
41626      closeArray();
41627    }
41628    ;
41629    if (element.hasContentDefinition()) {
41630      composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
41631    }
41632    if (element.hasTerm()) {
41633      openArray("term");
41634      for (Contract.TermComponent e : element.getTerm())
41635        composeContractTermComponent(null, e);
41636      closeArray();
41637    }
41638    ;
41639    if (element.hasSupportingInfo()) {
41640      openArray("supportingInfo");
41641      for (Reference e : element.getSupportingInfo())
41642        composeReference(null, e);
41643      closeArray();
41644    }
41645    ;
41646    if (element.hasRelevantHistory()) {
41647      openArray("relevantHistory");
41648      for (Reference e : element.getRelevantHistory())
41649        composeReference(null, e);
41650      closeArray();
41651    }
41652    ;
41653    if (element.hasSigner()) {
41654      openArray("signer");
41655      for (Contract.SignatoryComponent e : element.getSigner())
41656        composeContractSignatoryComponent(null, e);
41657      closeArray();
41658    }
41659    ;
41660    if (element.hasFriendly()) {
41661      openArray("friendly");
41662      for (Contract.FriendlyLanguageComponent e : element.getFriendly())
41663        composeContractFriendlyLanguageComponent(null, e);
41664      closeArray();
41665    }
41666    ;
41667    if (element.hasLegal()) {
41668      openArray("legal");
41669      for (Contract.LegalLanguageComponent e : element.getLegal())
41670        composeContractLegalLanguageComponent(null, e);
41671      closeArray();
41672    }
41673    ;
41674    if (element.hasRule()) {
41675      openArray("rule");
41676      for (Contract.ComputableLanguageComponent e : element.getRule())
41677        composeContractComputableLanguageComponent(null, e);
41678      closeArray();
41679    }
41680    ;
41681    if (element.hasLegallyBinding()) {
41682      composeType("legallyBinding", element.getLegallyBinding());
41683    }
41684  }
41685
41686  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element)
41687      throws IOException {
41688    if (element != null) {
41689      open(name);
41690      composeContractContentDefinitionComponentInner(element);
41691      close();
41692    }
41693  }
41694
41695  protected void composeContractContentDefinitionComponentInner(Contract.ContentDefinitionComponent element)
41696      throws IOException {
41697    composeBackbone(element);
41698    if (element.hasType()) {
41699      composeCodeableConcept("type", element.getType());
41700    }
41701    if (element.hasSubType()) {
41702      composeCodeableConcept("subType", element.getSubType());
41703    }
41704    if (element.hasPublisher()) {
41705      composeReference("publisher", element.getPublisher());
41706    }
41707    if (element.hasPublicationDateElement()) {
41708      composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
41709      composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
41710    }
41711    if (element.hasPublicationStatusElement()) {
41712      composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(),
41713          new Contract.ContractPublicationStatusEnumFactory(), false);
41714      composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(),
41715          new Contract.ContractPublicationStatusEnumFactory(), false);
41716    }
41717    if (element.hasCopyrightElement()) {
41718      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41719      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41720    }
41721  }
41722
41723  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
41724    if (element != null) {
41725      open(name);
41726      composeContractTermComponentInner(element);
41727      close();
41728    }
41729  }
41730
41731  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
41732    composeBackbone(element);
41733    if (element.hasIdentifier()) {
41734      composeIdentifier("identifier", element.getIdentifier());
41735    }
41736    if (element.hasIssuedElement()) {
41737      composeDateTimeCore("issued", element.getIssuedElement(), false);
41738      composeDateTimeExtras("issued", element.getIssuedElement(), false);
41739    }
41740    if (element.hasApplies()) {
41741      composePeriod("applies", element.getApplies());
41742    }
41743    if (element.hasTopic()) {
41744      composeType("topic", element.getTopic());
41745    }
41746    if (element.hasType()) {
41747      composeCodeableConcept("type", element.getType());
41748    }
41749    if (element.hasSubType()) {
41750      composeCodeableConcept("subType", element.getSubType());
41751    }
41752    if (element.hasTextElement()) {
41753      composeStringCore("text", element.getTextElement(), false);
41754      composeStringExtras("text", element.getTextElement(), false);
41755    }
41756    if (element.hasSecurityLabel()) {
41757      openArray("securityLabel");
41758      for (Contract.SecurityLabelComponent e : element.getSecurityLabel())
41759        composeContractSecurityLabelComponent(null, e);
41760      closeArray();
41761    }
41762    ;
41763    if (element.hasOffer()) {
41764      composeContractContractOfferComponent("offer", element.getOffer());
41765    }
41766    if (element.hasAsset()) {
41767      openArray("asset");
41768      for (Contract.ContractAssetComponent e : element.getAsset())
41769        composeContractContractAssetComponent(null, e);
41770      closeArray();
41771    }
41772    ;
41773    if (element.hasAction()) {
41774      openArray("action");
41775      for (Contract.ActionComponent e : element.getAction())
41776        composeContractActionComponent(null, e);
41777      closeArray();
41778    }
41779    ;
41780    if (element.hasGroup()) {
41781      openArray("group");
41782      for (Contract.TermComponent e : element.getGroup())
41783        composeContractTermComponent(null, e);
41784      closeArray();
41785    }
41786    ;
41787  }
41788
41789  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element)
41790      throws IOException {
41791    if (element != null) {
41792      open(name);
41793      composeContractSecurityLabelComponentInner(element);
41794      close();
41795    }
41796  }
41797
41798  protected void composeContractSecurityLabelComponentInner(Contract.SecurityLabelComponent element)
41799      throws IOException {
41800    composeBackbone(element);
41801    if (element.hasNumber()) {
41802      openArray("number");
41803      for (UnsignedIntType e : element.getNumber())
41804        composeUnsignedIntCore(null, e, true);
41805      closeArray();
41806      if (anyHasExtras(element.getNumber())) {
41807        openArray("_number");
41808        for (UnsignedIntType e : element.getNumber())
41809          composeUnsignedIntExtras(null, e, true);
41810        closeArray();
41811      }
41812    }
41813    ;
41814    if (element.hasClassification()) {
41815      composeCoding("classification", element.getClassification());
41816    }
41817    if (element.hasCategory()) {
41818      openArray("category");
41819      for (Coding e : element.getCategory())
41820        composeCoding(null, e);
41821      closeArray();
41822    }
41823    ;
41824    if (element.hasControl()) {
41825      openArray("control");
41826      for (Coding e : element.getControl())
41827        composeCoding(null, e);
41828      closeArray();
41829    }
41830    ;
41831  }
41832
41833  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element)
41834      throws IOException {
41835    if (element != null) {
41836      open(name);
41837      composeContractContractOfferComponentInner(element);
41838      close();
41839    }
41840  }
41841
41842  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element)
41843      throws IOException {
41844    composeBackbone(element);
41845    if (element.hasIdentifier()) {
41846      openArray("identifier");
41847      for (Identifier e : element.getIdentifier())
41848        composeIdentifier(null, e);
41849      closeArray();
41850    }
41851    ;
41852    if (element.hasParty()) {
41853      openArray("party");
41854      for (Contract.ContractPartyComponent e : element.getParty())
41855        composeContractContractPartyComponent(null, e);
41856      closeArray();
41857    }
41858    ;
41859    if (element.hasTopic()) {
41860      composeReference("topic", element.getTopic());
41861    }
41862    if (element.hasType()) {
41863      composeCodeableConcept("type", element.getType());
41864    }
41865    if (element.hasDecision()) {
41866      composeCodeableConcept("decision", element.getDecision());
41867    }
41868    if (element.hasDecisionMode()) {
41869      openArray("decisionMode");
41870      for (CodeableConcept e : element.getDecisionMode())
41871        composeCodeableConcept(null, e);
41872      closeArray();
41873    }
41874    ;
41875    if (element.hasAnswer()) {
41876      openArray("answer");
41877      for (Contract.AnswerComponent e : element.getAnswer())
41878        composeContractAnswerComponent(null, e);
41879      closeArray();
41880    }
41881    ;
41882    if (element.hasTextElement()) {
41883      composeStringCore("text", element.getTextElement(), false);
41884      composeStringExtras("text", element.getTextElement(), false);
41885    }
41886    if (element.hasLinkId()) {
41887      openArray("linkId");
41888      for (StringType e : element.getLinkId())
41889        composeStringCore(null, e, true);
41890      closeArray();
41891      if (anyHasExtras(element.getLinkId())) {
41892        openArray("_linkId");
41893        for (StringType e : element.getLinkId())
41894          composeStringExtras(null, e, true);
41895        closeArray();
41896      }
41897    }
41898    ;
41899    if (element.hasSecurityLabelNumber()) {
41900      openArray("securityLabelNumber");
41901      for (UnsignedIntType e : element.getSecurityLabelNumber())
41902        composeUnsignedIntCore(null, e, true);
41903      closeArray();
41904      if (anyHasExtras(element.getSecurityLabelNumber())) {
41905        openArray("_securityLabelNumber");
41906        for (UnsignedIntType e : element.getSecurityLabelNumber())
41907          composeUnsignedIntExtras(null, e, true);
41908        closeArray();
41909      }
41910    }
41911    ;
41912  }
41913
41914  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element)
41915      throws IOException {
41916    if (element != null) {
41917      open(name);
41918      composeContractContractPartyComponentInner(element);
41919      close();
41920    }
41921  }
41922
41923  protected void composeContractContractPartyComponentInner(Contract.ContractPartyComponent element)
41924      throws IOException {
41925    composeBackbone(element);
41926    if (element.hasReference()) {
41927      openArray("reference");
41928      for (Reference e : element.getReference())
41929        composeReference(null, e);
41930      closeArray();
41931    }
41932    ;
41933    if (element.hasRole()) {
41934      composeCodeableConcept("role", element.getRole());
41935    }
41936  }
41937
41938  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
41939    if (element != null) {
41940      open(name);
41941      composeContractAnswerComponentInner(element);
41942      close();
41943    }
41944  }
41945
41946  protected void composeContractAnswerComponentInner(Contract.AnswerComponent element) throws IOException {
41947    composeBackbone(element);
41948    if (element.hasValue()) {
41949      composeType("value", element.getValue());
41950    }
41951  }
41952
41953  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element)
41954      throws IOException {
41955    if (element != null) {
41956      open(name);
41957      composeContractContractAssetComponentInner(element);
41958      close();
41959    }
41960  }
41961
41962  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element)
41963      throws IOException {
41964    composeBackbone(element);
41965    if (element.hasScope()) {
41966      composeCodeableConcept("scope", element.getScope());
41967    }
41968    if (element.hasType()) {
41969      openArray("type");
41970      for (CodeableConcept e : element.getType())
41971        composeCodeableConcept(null, e);
41972      closeArray();
41973    }
41974    ;
41975    if (element.hasTypeReference()) {
41976      openArray("typeReference");
41977      for (Reference e : element.getTypeReference())
41978        composeReference(null, e);
41979      closeArray();
41980    }
41981    ;
41982    if (element.hasSubtype()) {
41983      openArray("subtype");
41984      for (CodeableConcept e : element.getSubtype())
41985        composeCodeableConcept(null, e);
41986      closeArray();
41987    }
41988    ;
41989    if (element.hasRelationship()) {
41990      composeCoding("relationship", element.getRelationship());
41991    }
41992    if (element.hasContext()) {
41993      openArray("context");
41994      for (Contract.AssetContextComponent e : element.getContext())
41995        composeContractAssetContextComponent(null, e);
41996      closeArray();
41997    }
41998    ;
41999    if (element.hasConditionElement()) {
42000      composeStringCore("condition", element.getConditionElement(), false);
42001      composeStringExtras("condition", element.getConditionElement(), false);
42002    }
42003    if (element.hasPeriodType()) {
42004      openArray("periodType");
42005      for (CodeableConcept e : element.getPeriodType())
42006        composeCodeableConcept(null, e);
42007      closeArray();
42008    }
42009    ;
42010    if (element.hasPeriod()) {
42011      openArray("period");
42012      for (Period e : element.getPeriod())
42013        composePeriod(null, e);
42014      closeArray();
42015    }
42016    ;
42017    if (element.hasUsePeriod()) {
42018      openArray("usePeriod");
42019      for (Period e : element.getUsePeriod())
42020        composePeriod(null, e);
42021      closeArray();
42022    }
42023    ;
42024    if (element.hasTextElement()) {
42025      composeStringCore("text", element.getTextElement(), false);
42026      composeStringExtras("text", element.getTextElement(), false);
42027    }
42028    if (element.hasLinkId()) {
42029      openArray("linkId");
42030      for (StringType e : element.getLinkId())
42031        composeStringCore(null, e, true);
42032      closeArray();
42033      if (anyHasExtras(element.getLinkId())) {
42034        openArray("_linkId");
42035        for (StringType e : element.getLinkId())
42036          composeStringExtras(null, e, true);
42037        closeArray();
42038      }
42039    }
42040    ;
42041    if (element.hasAnswer()) {
42042      openArray("answer");
42043      for (Contract.AnswerComponent e : element.getAnswer())
42044        composeContractAnswerComponent(null, e);
42045      closeArray();
42046    }
42047    ;
42048    if (element.hasSecurityLabelNumber()) {
42049      openArray("securityLabelNumber");
42050      for (UnsignedIntType e : element.getSecurityLabelNumber())
42051        composeUnsignedIntCore(null, e, true);
42052      closeArray();
42053      if (anyHasExtras(element.getSecurityLabelNumber())) {
42054        openArray("_securityLabelNumber");
42055        for (UnsignedIntType e : element.getSecurityLabelNumber())
42056          composeUnsignedIntExtras(null, e, true);
42057        closeArray();
42058      }
42059    }
42060    ;
42061    if (element.hasValuedItem()) {
42062      openArray("valuedItem");
42063      for (Contract.ValuedItemComponent e : element.getValuedItem())
42064        composeContractValuedItemComponent(null, e);
42065      closeArray();
42066    }
42067    ;
42068  }
42069
42070  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element)
42071      throws IOException {
42072    if (element != null) {
42073      open(name);
42074      composeContractAssetContextComponentInner(element);
42075      close();
42076    }
42077  }
42078
42079  protected void composeContractAssetContextComponentInner(Contract.AssetContextComponent element) throws IOException {
42080    composeBackbone(element);
42081    if (element.hasReference()) {
42082      composeReference("reference", element.getReference());
42083    }
42084    if (element.hasCode()) {
42085      openArray("code");
42086      for (CodeableConcept e : element.getCode())
42087        composeCodeableConcept(null, e);
42088      closeArray();
42089    }
42090    ;
42091    if (element.hasTextElement()) {
42092      composeStringCore("text", element.getTextElement(), false);
42093      composeStringExtras("text", element.getTextElement(), false);
42094    }
42095  }
42096
42097  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element)
42098      throws IOException {
42099    if (element != null) {
42100      open(name);
42101      composeContractValuedItemComponentInner(element);
42102      close();
42103    }
42104  }
42105
42106  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
42107    composeBackbone(element);
42108    if (element.hasEntity()) {
42109      composeType("entity", element.getEntity());
42110    }
42111    if (element.hasIdentifier()) {
42112      composeIdentifier("identifier", element.getIdentifier());
42113    }
42114    if (element.hasEffectiveTimeElement()) {
42115      composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
42116      composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
42117    }
42118    if (element.hasQuantity()) {
42119      composeQuantity("quantity", element.getQuantity());
42120    }
42121    if (element.hasUnitPrice()) {
42122      composeMoney("unitPrice", element.getUnitPrice());
42123    }
42124    if (element.hasFactorElement()) {
42125      composeDecimalCore("factor", element.getFactorElement(), false);
42126      composeDecimalExtras("factor", element.getFactorElement(), false);
42127    }
42128    if (element.hasPointsElement()) {
42129      composeDecimalCore("points", element.getPointsElement(), false);
42130      composeDecimalExtras("points", element.getPointsElement(), false);
42131    }
42132    if (element.hasNet()) {
42133      composeMoney("net", element.getNet());
42134    }
42135    if (element.hasPaymentElement()) {
42136      composeStringCore("payment", element.getPaymentElement(), false);
42137      composeStringExtras("payment", element.getPaymentElement(), false);
42138    }
42139    if (element.hasPaymentDateElement()) {
42140      composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
42141      composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
42142    }
42143    if (element.hasResponsible()) {
42144      composeReference("responsible", element.getResponsible());
42145    }
42146    if (element.hasRecipient()) {
42147      composeReference("recipient", element.getRecipient());
42148    }
42149    if (element.hasLinkId()) {
42150      openArray("linkId");
42151      for (StringType e : element.getLinkId())
42152        composeStringCore(null, e, true);
42153      closeArray();
42154      if (anyHasExtras(element.getLinkId())) {
42155        openArray("_linkId");
42156        for (StringType e : element.getLinkId())
42157          composeStringExtras(null, e, true);
42158        closeArray();
42159      }
42160    }
42161    ;
42162    if (element.hasSecurityLabelNumber()) {
42163      openArray("securityLabelNumber");
42164      for (UnsignedIntType e : element.getSecurityLabelNumber())
42165        composeUnsignedIntCore(null, e, true);
42166      closeArray();
42167      if (anyHasExtras(element.getSecurityLabelNumber())) {
42168        openArray("_securityLabelNumber");
42169        for (UnsignedIntType e : element.getSecurityLabelNumber())
42170          composeUnsignedIntExtras(null, e, true);
42171        closeArray();
42172      }
42173    }
42174    ;
42175  }
42176
42177  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
42178    if (element != null) {
42179      open(name);
42180      composeContractActionComponentInner(element);
42181      close();
42182    }
42183  }
42184
42185  protected void composeContractActionComponentInner(Contract.ActionComponent element) throws IOException {
42186    composeBackbone(element);
42187    if (element.hasDoNotPerformElement()) {
42188      composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
42189      composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
42190    }
42191    if (element.hasType()) {
42192      composeCodeableConcept("type", element.getType());
42193    }
42194    if (element.hasSubject()) {
42195      openArray("subject");
42196      for (Contract.ActionSubjectComponent e : element.getSubject())
42197        composeContractActionSubjectComponent(null, e);
42198      closeArray();
42199    }
42200    ;
42201    if (element.hasIntent()) {
42202      composeCodeableConcept("intent", element.getIntent());
42203    }
42204    if (element.hasLinkId()) {
42205      openArray("linkId");
42206      for (StringType e : element.getLinkId())
42207        composeStringCore(null, e, true);
42208      closeArray();
42209      if (anyHasExtras(element.getLinkId())) {
42210        openArray("_linkId");
42211        for (StringType e : element.getLinkId())
42212          composeStringExtras(null, e, true);
42213        closeArray();
42214      }
42215    }
42216    ;
42217    if (element.hasStatus()) {
42218      composeCodeableConcept("status", element.getStatus());
42219    }
42220    if (element.hasContext()) {
42221      composeReference("context", element.getContext());
42222    }
42223    if (element.hasContextLinkId()) {
42224      openArray("contextLinkId");
42225      for (StringType e : element.getContextLinkId())
42226        composeStringCore(null, e, true);
42227      closeArray();
42228      if (anyHasExtras(element.getContextLinkId())) {
42229        openArray("_contextLinkId");
42230        for (StringType e : element.getContextLinkId())
42231          composeStringExtras(null, e, true);
42232        closeArray();
42233      }
42234    }
42235    ;
42236    if (element.hasOccurrence()) {
42237      composeType("occurrence", element.getOccurrence());
42238    }
42239    if (element.hasRequester()) {
42240      openArray("requester");
42241      for (Reference e : element.getRequester())
42242        composeReference(null, e);
42243      closeArray();
42244    }
42245    ;
42246    if (element.hasRequesterLinkId()) {
42247      openArray("requesterLinkId");
42248      for (StringType e : element.getRequesterLinkId())
42249        composeStringCore(null, e, true);
42250      closeArray();
42251      if (anyHasExtras(element.getRequesterLinkId())) {
42252        openArray("_requesterLinkId");
42253        for (StringType e : element.getRequesterLinkId())
42254          composeStringExtras(null, e, true);
42255        closeArray();
42256      }
42257    }
42258    ;
42259    if (element.hasPerformerType()) {
42260      openArray("performerType");
42261      for (CodeableConcept e : element.getPerformerType())
42262        composeCodeableConcept(null, e);
42263      closeArray();
42264    }
42265    ;
42266    if (element.hasPerformerRole()) {
42267      composeCodeableConcept("performerRole", element.getPerformerRole());
42268    }
42269    if (element.hasPerformer()) {
42270      composeReference("performer", element.getPerformer());
42271    }
42272    if (element.hasPerformerLinkId()) {
42273      openArray("performerLinkId");
42274      for (StringType e : element.getPerformerLinkId())
42275        composeStringCore(null, e, true);
42276      closeArray();
42277      if (anyHasExtras(element.getPerformerLinkId())) {
42278        openArray("_performerLinkId");
42279        for (StringType e : element.getPerformerLinkId())
42280          composeStringExtras(null, e, true);
42281        closeArray();
42282      }
42283    }
42284    ;
42285    if (element.hasReasonCode()) {
42286      openArray("reasonCode");
42287      for (CodeableConcept e : element.getReasonCode())
42288        composeCodeableConcept(null, e);
42289      closeArray();
42290    }
42291    ;
42292    if (element.hasReasonReference()) {
42293      openArray("reasonReference");
42294      for (Reference e : element.getReasonReference())
42295        composeReference(null, e);
42296      closeArray();
42297    }
42298    ;
42299    if (element.hasReason()) {
42300      openArray("reason");
42301      for (StringType e : element.getReason())
42302        composeStringCore(null, e, true);
42303      closeArray();
42304      if (anyHasExtras(element.getReason())) {
42305        openArray("_reason");
42306        for (StringType e : element.getReason())
42307          composeStringExtras(null, e, true);
42308        closeArray();
42309      }
42310    }
42311    ;
42312    if (element.hasReasonLinkId()) {
42313      openArray("reasonLinkId");
42314      for (StringType e : element.getReasonLinkId())
42315        composeStringCore(null, e, true);
42316      closeArray();
42317      if (anyHasExtras(element.getReasonLinkId())) {
42318        openArray("_reasonLinkId");
42319        for (StringType e : element.getReasonLinkId())
42320          composeStringExtras(null, e, true);
42321        closeArray();
42322      }
42323    }
42324    ;
42325    if (element.hasNote()) {
42326      openArray("note");
42327      for (Annotation e : element.getNote())
42328        composeAnnotation(null, e);
42329      closeArray();
42330    }
42331    ;
42332    if (element.hasSecurityLabelNumber()) {
42333      openArray("securityLabelNumber");
42334      for (UnsignedIntType e : element.getSecurityLabelNumber())
42335        composeUnsignedIntCore(null, e, true);
42336      closeArray();
42337      if (anyHasExtras(element.getSecurityLabelNumber())) {
42338        openArray("_securityLabelNumber");
42339        for (UnsignedIntType e : element.getSecurityLabelNumber())
42340          composeUnsignedIntExtras(null, e, true);
42341        closeArray();
42342      }
42343    }
42344    ;
42345  }
42346
42347  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element)
42348      throws IOException {
42349    if (element != null) {
42350      open(name);
42351      composeContractActionSubjectComponentInner(element);
42352      close();
42353    }
42354  }
42355
42356  protected void composeContractActionSubjectComponentInner(Contract.ActionSubjectComponent element)
42357      throws IOException {
42358    composeBackbone(element);
42359    if (element.hasReference()) {
42360      openArray("reference");
42361      for (Reference e : element.getReference())
42362        composeReference(null, e);
42363      closeArray();
42364    }
42365    ;
42366    if (element.hasRole()) {
42367      composeCodeableConcept("role", element.getRole());
42368    }
42369  }
42370
42371  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element)
42372      throws IOException {
42373    if (element != null) {
42374      open(name);
42375      composeContractSignatoryComponentInner(element);
42376      close();
42377    }
42378  }
42379
42380  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
42381    composeBackbone(element);
42382    if (element.hasType()) {
42383      composeCoding("type", element.getType());
42384    }
42385    if (element.hasParty()) {
42386      composeReference("party", element.getParty());
42387    }
42388    if (element.hasSignature()) {
42389      openArray("signature");
42390      for (Signature e : element.getSignature())
42391        composeSignature(null, e);
42392      closeArray();
42393    }
42394    ;
42395  }
42396
42397  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element)
42398      throws IOException {
42399    if (element != null) {
42400      open(name);
42401      composeContractFriendlyLanguageComponentInner(element);
42402      close();
42403    }
42404  }
42405
42406  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element)
42407      throws IOException {
42408    composeBackbone(element);
42409    if (element.hasContent()) {
42410      composeType("content", element.getContent());
42411    }
42412  }
42413
42414  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element)
42415      throws IOException {
42416    if (element != null) {
42417      open(name);
42418      composeContractLegalLanguageComponentInner(element);
42419      close();
42420    }
42421  }
42422
42423  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element)
42424      throws IOException {
42425    composeBackbone(element);
42426    if (element.hasContent()) {
42427      composeType("content", element.getContent());
42428    }
42429  }
42430
42431  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element)
42432      throws IOException {
42433    if (element != null) {
42434      open(name);
42435      composeContractComputableLanguageComponentInner(element);
42436      close();
42437    }
42438  }
42439
42440  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element)
42441      throws IOException {
42442    composeBackbone(element);
42443    if (element.hasContent()) {
42444      composeType("content", element.getContent());
42445    }
42446  }
42447
42448  protected void composeCoverage(String name, Coverage element) throws IOException {
42449    if (element != null) {
42450      prop("resourceType", name);
42451      composeCoverageInner(element);
42452    }
42453  }
42454
42455  protected void composeCoverageInner(Coverage element) throws IOException {
42456    composeDomainResourceElements(element);
42457    if (element.hasIdentifier()) {
42458      openArray("identifier");
42459      for (Identifier e : element.getIdentifier())
42460        composeIdentifier(null, e);
42461      closeArray();
42462    }
42463    ;
42464    if (element.hasStatusElement()) {
42465      composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
42466      composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
42467    }
42468    if (element.hasType()) {
42469      composeCodeableConcept("type", element.getType());
42470    }
42471    if (element.hasPolicyHolder()) {
42472      composeReference("policyHolder", element.getPolicyHolder());
42473    }
42474    if (element.hasSubscriber()) {
42475      composeReference("subscriber", element.getSubscriber());
42476    }
42477    if (element.hasSubscriberIdElement()) {
42478      composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
42479      composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
42480    }
42481    if (element.hasBeneficiary()) {
42482      composeReference("beneficiary", element.getBeneficiary());
42483    }
42484    if (element.hasDependentElement()) {
42485      composeStringCore("dependent", element.getDependentElement(), false);
42486      composeStringExtras("dependent", element.getDependentElement(), false);
42487    }
42488    if (element.hasRelationship()) {
42489      composeCodeableConcept("relationship", element.getRelationship());
42490    }
42491    if (element.hasPeriod()) {
42492      composePeriod("period", element.getPeriod());
42493    }
42494    if (element.hasPayor()) {
42495      openArray("payor");
42496      for (Reference e : element.getPayor())
42497        composeReference(null, e);
42498      closeArray();
42499    }
42500    ;
42501    if (element.hasClass_()) {
42502      openArray("class");
42503      for (Coverage.ClassComponent e : element.getClass_())
42504        composeCoverageClassComponent(null, e);
42505      closeArray();
42506    }
42507    ;
42508    if (element.hasOrderElement()) {
42509      composePositiveIntCore("order", element.getOrderElement(), false);
42510      composePositiveIntExtras("order", element.getOrderElement(), false);
42511    }
42512    if (element.hasNetworkElement()) {
42513      composeStringCore("network", element.getNetworkElement(), false);
42514      composeStringExtras("network", element.getNetworkElement(), false);
42515    }
42516    if (element.hasCostToBeneficiary()) {
42517      openArray("costToBeneficiary");
42518      for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary())
42519        composeCoverageCostToBeneficiaryComponent(null, e);
42520      closeArray();
42521    }
42522    ;
42523    if (element.hasSubrogationElement()) {
42524      composeBooleanCore("subrogation", element.getSubrogationElement(), false);
42525      composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
42526    }
42527    if (element.hasContract()) {
42528      openArray("contract");
42529      for (Reference e : element.getContract())
42530        composeReference(null, e);
42531      closeArray();
42532    }
42533    ;
42534  }
42535
42536  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
42537    if (element != null) {
42538      open(name);
42539      composeCoverageClassComponentInner(element);
42540      close();
42541    }
42542  }
42543
42544  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
42545    composeBackbone(element);
42546    if (element.hasType()) {
42547      composeCodeableConcept("type", element.getType());
42548    }
42549    if (element.hasValueElement()) {
42550      composeStringCore("value", element.getValueElement(), false);
42551      composeStringExtras("value", element.getValueElement(), false);
42552    }
42553    if (element.hasNameElement()) {
42554      composeStringCore("name", element.getNameElement(), false);
42555      composeStringExtras("name", element.getNameElement(), false);
42556    }
42557  }
42558
42559  protected void composeCoverageCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element)
42560      throws IOException {
42561    if (element != null) {
42562      open(name);
42563      composeCoverageCostToBeneficiaryComponentInner(element);
42564      close();
42565    }
42566  }
42567
42568  protected void composeCoverageCostToBeneficiaryComponentInner(Coverage.CostToBeneficiaryComponent element)
42569      throws IOException {
42570    composeBackbone(element);
42571    if (element.hasType()) {
42572      composeCodeableConcept("type", element.getType());
42573    }
42574    if (element.hasValue()) {
42575      composeType("value", element.getValue());
42576    }
42577    if (element.hasException()) {
42578      openArray("exception");
42579      for (Coverage.ExemptionComponent e : element.getException())
42580        composeCoverageExemptionComponent(null, e);
42581      closeArray();
42582    }
42583    ;
42584  }
42585
42586  protected void composeCoverageExemptionComponent(String name, Coverage.ExemptionComponent element)
42587      throws IOException {
42588    if (element != null) {
42589      open(name);
42590      composeCoverageExemptionComponentInner(element);
42591      close();
42592    }
42593  }
42594
42595  protected void composeCoverageExemptionComponentInner(Coverage.ExemptionComponent element) throws IOException {
42596    composeBackbone(element);
42597    if (element.hasType()) {
42598      composeCodeableConcept("type", element.getType());
42599    }
42600    if (element.hasPeriod()) {
42601      composePeriod("period", element.getPeriod());
42602    }
42603  }
42604
42605  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
42606    if (element != null) {
42607      prop("resourceType", name);
42608      composeCoverageEligibilityRequestInner(element);
42609    }
42610  }
42611
42612  protected void composeCoverageEligibilityRequestInner(CoverageEligibilityRequest element) throws IOException {
42613    composeDomainResourceElements(element);
42614    if (element.hasIdentifier()) {
42615      openArray("identifier");
42616      for (Identifier e : element.getIdentifier())
42617        composeIdentifier(null, e);
42618      closeArray();
42619    }
42620    ;
42621    if (element.hasStatusElement()) {
42622      composeEnumerationCore("status", element.getStatusElement(),
42623          new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
42624      composeEnumerationExtras("status", element.getStatusElement(),
42625          new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
42626    }
42627    if (element.hasPriority()) {
42628      composeCodeableConcept("priority", element.getPriority());
42629    }
42630    if (element.hasPurpose()) {
42631      openArray("purpose");
42632      for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose())
42633        composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
42634      closeArray();
42635      if (anyHasExtras(element.getPurpose())) {
42636        openArray("_purpose");
42637        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose())
42638          composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(),
42639              true);
42640        closeArray();
42641      }
42642    }
42643    ;
42644    if (element.hasPatient()) {
42645      composeReference("patient", element.getPatient());
42646    }
42647    if (element.hasServiced()) {
42648      composeType("serviced", element.getServiced());
42649    }
42650    if (element.hasCreatedElement()) {
42651      composeDateTimeCore("created", element.getCreatedElement(), false);
42652      composeDateTimeExtras("created", element.getCreatedElement(), false);
42653    }
42654    if (element.hasEnterer()) {
42655      composeReference("enterer", element.getEnterer());
42656    }
42657    if (element.hasProvider()) {
42658      composeReference("provider", element.getProvider());
42659    }
42660    if (element.hasInsurer()) {
42661      composeReference("insurer", element.getInsurer());
42662    }
42663    if (element.hasFacility()) {
42664      composeReference("facility", element.getFacility());
42665    }
42666    if (element.hasSupportingInfo()) {
42667      openArray("supportingInfo");
42668      for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo())
42669        composeCoverageEligibilityRequestSupportingInformationComponent(null, e);
42670      closeArray();
42671    }
42672    ;
42673    if (element.hasInsurance()) {
42674      openArray("insurance");
42675      for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance())
42676        composeCoverageEligibilityRequestInsuranceComponent(null, e);
42677      closeArray();
42678    }
42679    ;
42680    if (element.hasItem()) {
42681      openArray("item");
42682      for (CoverageEligibilityRequest.DetailsComponent e : element.getItem())
42683        composeCoverageEligibilityRequestDetailsComponent(null, e);
42684      closeArray();
42685    }
42686    ;
42687  }
42688
42689  protected void composeCoverageEligibilityRequestSupportingInformationComponent(String name,
42690      CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
42691    if (element != null) {
42692      open(name);
42693      composeCoverageEligibilityRequestSupportingInformationComponentInner(element);
42694      close();
42695    }
42696  }
42697
42698  protected void composeCoverageEligibilityRequestSupportingInformationComponentInner(
42699      CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
42700    composeBackbone(element);
42701    if (element.hasSequenceElement()) {
42702      composePositiveIntCore("sequence", element.getSequenceElement(), false);
42703      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42704    }
42705    if (element.hasInformation()) {
42706      composeReference("information", element.getInformation());
42707    }
42708    if (element.hasAppliesToAllElement()) {
42709      composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
42710      composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
42711    }
42712  }
42713
42714  protected void composeCoverageEligibilityRequestInsuranceComponent(String name,
42715      CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
42716    if (element != null) {
42717      open(name);
42718      composeCoverageEligibilityRequestInsuranceComponentInner(element);
42719      close();
42720    }
42721  }
42722
42723  protected void composeCoverageEligibilityRequestInsuranceComponentInner(
42724      CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
42725    composeBackbone(element);
42726    if (element.hasFocalElement()) {
42727      composeBooleanCore("focal", element.getFocalElement(), false);
42728      composeBooleanExtras("focal", element.getFocalElement(), false);
42729    }
42730    if (element.hasCoverage()) {
42731      composeReference("coverage", element.getCoverage());
42732    }
42733    if (element.hasBusinessArrangementElement()) {
42734      composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
42735      composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
42736    }
42737  }
42738
42739  protected void composeCoverageEligibilityRequestDetailsComponent(String name,
42740      CoverageEligibilityRequest.DetailsComponent element) throws IOException {
42741    if (element != null) {
42742      open(name);
42743      composeCoverageEligibilityRequestDetailsComponentInner(element);
42744      close();
42745    }
42746  }
42747
42748  protected void composeCoverageEligibilityRequestDetailsComponentInner(
42749      CoverageEligibilityRequest.DetailsComponent element) throws IOException {
42750    composeBackbone(element);
42751    if (element.hasSupportingInfoSequence()) {
42752      openArray("supportingInfoSequence");
42753      for (PositiveIntType e : element.getSupportingInfoSequence())
42754        composePositiveIntCore(null, e, true);
42755      closeArray();
42756      if (anyHasExtras(element.getSupportingInfoSequence())) {
42757        openArray("_supportingInfoSequence");
42758        for (PositiveIntType e : element.getSupportingInfoSequence())
42759          composePositiveIntExtras(null, e, true);
42760        closeArray();
42761      }
42762    }
42763    ;
42764    if (element.hasCategory()) {
42765      composeCodeableConcept("category", element.getCategory());
42766    }
42767    if (element.hasProductOrService()) {
42768      composeCodeableConcept("productOrService", element.getProductOrService());
42769    }
42770    if (element.hasModifier()) {
42771      openArray("modifier");
42772      for (CodeableConcept e : element.getModifier())
42773        composeCodeableConcept(null, e);
42774      closeArray();
42775    }
42776    ;
42777    if (element.hasProvider()) {
42778      composeReference("provider", element.getProvider());
42779    }
42780    if (element.hasQuantity()) {
42781      composeQuantity("quantity", element.getQuantity());
42782    }
42783    if (element.hasUnitPrice()) {
42784      composeMoney("unitPrice", element.getUnitPrice());
42785    }
42786    if (element.hasFacility()) {
42787      composeReference("facility", element.getFacility());
42788    }
42789    if (element.hasDiagnosis()) {
42790      openArray("diagnosis");
42791      for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis())
42792        composeCoverageEligibilityRequestDiagnosisComponent(null, e);
42793      closeArray();
42794    }
42795    ;
42796    if (element.hasDetail()) {
42797      openArray("detail");
42798      for (Reference e : element.getDetail())
42799        composeReference(null, e);
42800      closeArray();
42801    }
42802    ;
42803  }
42804
42805  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name,
42806      CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
42807    if (element != null) {
42808      open(name);
42809      composeCoverageEligibilityRequestDiagnosisComponentInner(element);
42810      close();
42811    }
42812  }
42813
42814  protected void composeCoverageEligibilityRequestDiagnosisComponentInner(
42815      CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
42816    composeBackbone(element);
42817    if (element.hasDiagnosis()) {
42818      composeType("diagnosis", element.getDiagnosis());
42819    }
42820  }
42821
42822  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element)
42823      throws IOException {
42824    if (element != null) {
42825      prop("resourceType", name);
42826      composeCoverageEligibilityResponseInner(element);
42827    }
42828  }
42829
42830  protected void composeCoverageEligibilityResponseInner(CoverageEligibilityResponse element) throws IOException {
42831    composeDomainResourceElements(element);
42832    if (element.hasIdentifier()) {
42833      openArray("identifier");
42834      for (Identifier e : element.getIdentifier())
42835        composeIdentifier(null, e);
42836      closeArray();
42837    }
42838    ;
42839    if (element.hasStatusElement()) {
42840      composeEnumerationCore("status", element.getStatusElement(),
42841          new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
42842      composeEnumerationExtras("status", element.getStatusElement(),
42843          new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
42844    }
42845    if (element.hasPurpose()) {
42846      openArray("purpose");
42847      for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose())
42848        composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
42849      closeArray();
42850      if (anyHasExtras(element.getPurpose())) {
42851        openArray("_purpose");
42852        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose())
42853          composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(),
42854              true);
42855        closeArray();
42856      }
42857    }
42858    ;
42859    if (element.hasPatient()) {
42860      composeReference("patient", element.getPatient());
42861    }
42862    if (element.hasServiced()) {
42863      composeType("serviced", element.getServiced());
42864    }
42865    if (element.hasCreatedElement()) {
42866      composeDateTimeCore("created", element.getCreatedElement(), false);
42867      composeDateTimeExtras("created", element.getCreatedElement(), false);
42868    }
42869    if (element.hasRequestor()) {
42870      composeReference("requestor", element.getRequestor());
42871    }
42872    if (element.hasRequest()) {
42873      composeReference("request", element.getRequest());
42874    }
42875    if (element.hasOutcomeElement()) {
42876      composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(),
42877          false);
42878      composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(),
42879          false);
42880    }
42881    if (element.hasDispositionElement()) {
42882      composeStringCore("disposition", element.getDispositionElement(), false);
42883      composeStringExtras("disposition", element.getDispositionElement(), false);
42884    }
42885    if (element.hasInsurer()) {
42886      composeReference("insurer", element.getInsurer());
42887    }
42888    if (element.hasInsurance()) {
42889      openArray("insurance");
42890      for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance())
42891        composeCoverageEligibilityResponseInsuranceComponent(null, e);
42892      closeArray();
42893    }
42894    ;
42895    if (element.hasPreAuthRefElement()) {
42896      composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
42897      composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
42898    }
42899    if (element.hasForm()) {
42900      composeCodeableConcept("form", element.getForm());
42901    }
42902    if (element.hasError()) {
42903      openArray("error");
42904      for (CoverageEligibilityResponse.ErrorsComponent e : element.getError())
42905        composeCoverageEligibilityResponseErrorsComponent(null, e);
42906      closeArray();
42907    }
42908    ;
42909  }
42910
42911  protected void composeCoverageEligibilityResponseInsuranceComponent(String name,
42912      CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
42913    if (element != null) {
42914      open(name);
42915      composeCoverageEligibilityResponseInsuranceComponentInner(element);
42916      close();
42917    }
42918  }
42919
42920  protected void composeCoverageEligibilityResponseInsuranceComponentInner(
42921      CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
42922    composeBackbone(element);
42923    if (element.hasCoverage()) {
42924      composeReference("coverage", element.getCoverage());
42925    }
42926    if (element.hasInforceElement()) {
42927      composeBooleanCore("inforce", element.getInforceElement(), false);
42928      composeBooleanExtras("inforce", element.getInforceElement(), false);
42929    }
42930    if (element.hasBenefitPeriod()) {
42931      composePeriod("benefitPeriod", element.getBenefitPeriod());
42932    }
42933    if (element.hasItem()) {
42934      openArray("item");
42935      for (CoverageEligibilityResponse.ItemsComponent e : element.getItem())
42936        composeCoverageEligibilityResponseItemsComponent(null, e);
42937      closeArray();
42938    }
42939    ;
42940  }
42941
42942  protected void composeCoverageEligibilityResponseItemsComponent(String name,
42943      CoverageEligibilityResponse.ItemsComponent element) throws IOException {
42944    if (element != null) {
42945      open(name);
42946      composeCoverageEligibilityResponseItemsComponentInner(element);
42947      close();
42948    }
42949  }
42950
42951  protected void composeCoverageEligibilityResponseItemsComponentInner(
42952      CoverageEligibilityResponse.ItemsComponent element) throws IOException {
42953    composeBackbone(element);
42954    if (element.hasCategory()) {
42955      composeCodeableConcept("category", element.getCategory());
42956    }
42957    if (element.hasProductOrService()) {
42958      composeCodeableConcept("productOrService", element.getProductOrService());
42959    }
42960    if (element.hasModifier()) {
42961      openArray("modifier");
42962      for (CodeableConcept e : element.getModifier())
42963        composeCodeableConcept(null, e);
42964      closeArray();
42965    }
42966    ;
42967    if (element.hasProvider()) {
42968      composeReference("provider", element.getProvider());
42969    }
42970    if (element.hasExcludedElement()) {
42971      composeBooleanCore("excluded", element.getExcludedElement(), false);
42972      composeBooleanExtras("excluded", element.getExcludedElement(), false);
42973    }
42974    if (element.hasNameElement()) {
42975      composeStringCore("name", element.getNameElement(), false);
42976      composeStringExtras("name", element.getNameElement(), false);
42977    }
42978    if (element.hasDescriptionElement()) {
42979      composeStringCore("description", element.getDescriptionElement(), false);
42980      composeStringExtras("description", element.getDescriptionElement(), false);
42981    }
42982    if (element.hasNetwork()) {
42983      composeCodeableConcept("network", element.getNetwork());
42984    }
42985    if (element.hasUnit()) {
42986      composeCodeableConcept("unit", element.getUnit());
42987    }
42988    if (element.hasTerm()) {
42989      composeCodeableConcept("term", element.getTerm());
42990    }
42991    if (element.hasBenefit()) {
42992      openArray("benefit");
42993      for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit())
42994        composeCoverageEligibilityResponseBenefitComponent(null, e);
42995      closeArray();
42996    }
42997    ;
42998    if (element.hasAuthorizationRequiredElement()) {
42999      composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
43000      composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
43001    }
43002    if (element.hasAuthorizationSupporting()) {
43003      openArray("authorizationSupporting");
43004      for (CodeableConcept e : element.getAuthorizationSupporting())
43005        composeCodeableConcept(null, e);
43006      closeArray();
43007    }
43008    ;
43009    if (element.hasAuthorizationUrlElement()) {
43010      composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
43011      composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
43012    }
43013  }
43014
43015  protected void composeCoverageEligibilityResponseBenefitComponent(String name,
43016      CoverageEligibilityResponse.BenefitComponent element) throws IOException {
43017    if (element != null) {
43018      open(name);
43019      composeCoverageEligibilityResponseBenefitComponentInner(element);
43020      close();
43021    }
43022  }
43023
43024  protected void composeCoverageEligibilityResponseBenefitComponentInner(
43025      CoverageEligibilityResponse.BenefitComponent element) throws IOException {
43026    composeBackbone(element);
43027    if (element.hasType()) {
43028      composeCodeableConcept("type", element.getType());
43029    }
43030    if (element.hasAllowed()) {
43031      composeType("allowed", element.getAllowed());
43032    }
43033    if (element.hasUsed()) {
43034      composeType("used", element.getUsed());
43035    }
43036  }
43037
43038  protected void composeCoverageEligibilityResponseErrorsComponent(String name,
43039      CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
43040    if (element != null) {
43041      open(name);
43042      composeCoverageEligibilityResponseErrorsComponentInner(element);
43043      close();
43044    }
43045  }
43046
43047  protected void composeCoverageEligibilityResponseErrorsComponentInner(
43048      CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
43049    composeBackbone(element);
43050    if (element.hasCode()) {
43051      composeCodeableConcept("code", element.getCode());
43052    }
43053  }
43054
43055  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
43056    if (element != null) {
43057      prop("resourceType", name);
43058      composeDetectedIssueInner(element);
43059    }
43060  }
43061
43062  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
43063    composeDomainResourceElements(element);
43064    if (element.hasIdentifier()) {
43065      openArray("identifier");
43066      for (Identifier e : element.getIdentifier())
43067        composeIdentifier(null, e);
43068      closeArray();
43069    }
43070    ;
43071    if (element.hasStatusElement()) {
43072      composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(),
43073          false);
43074      composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(),
43075          false);
43076    }
43077    if (element.hasCode()) {
43078      composeCodeableConcept("code", element.getCode());
43079    }
43080    if (element.hasSeverityElement()) {
43081      composeEnumerationCore("severity", element.getSeverityElement(),
43082          new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
43083      composeEnumerationExtras("severity", element.getSeverityElement(),
43084          new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
43085    }
43086    if (element.hasPatient()) {
43087      composeReference("patient", element.getPatient());
43088    }
43089    if (element.hasIdentified()) {
43090      composeType("identified", element.getIdentified());
43091    }
43092    if (element.hasAuthor()) {
43093      composeReference("author", element.getAuthor());
43094    }
43095    if (element.hasImplicated()) {
43096      openArray("implicated");
43097      for (Reference e : element.getImplicated())
43098        composeReference(null, e);
43099      closeArray();
43100    }
43101    ;
43102    if (element.hasEvidence()) {
43103      openArray("evidence");
43104      for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence())
43105        composeDetectedIssueDetectedIssueEvidenceComponent(null, e);
43106      closeArray();
43107    }
43108    ;
43109    if (element.hasDetailElement()) {
43110      composeStringCore("detail", element.getDetailElement(), false);
43111      composeStringExtras("detail", element.getDetailElement(), false);
43112    }
43113    if (element.hasReferenceElement()) {
43114      composeUriCore("reference", element.getReferenceElement(), false);
43115      composeUriExtras("reference", element.getReferenceElement(), false);
43116    }
43117    if (element.hasMitigation()) {
43118      openArray("mitigation");
43119      for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation())
43120        composeDetectedIssueDetectedIssueMitigationComponent(null, e);
43121      closeArray();
43122    }
43123    ;
43124  }
43125
43126  protected void composeDetectedIssueDetectedIssueEvidenceComponent(String name,
43127      DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
43128    if (element != null) {
43129      open(name);
43130      composeDetectedIssueDetectedIssueEvidenceComponentInner(element);
43131      close();
43132    }
43133  }
43134
43135  protected void composeDetectedIssueDetectedIssueEvidenceComponentInner(
43136      DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
43137    composeBackbone(element);
43138    if (element.hasCode()) {
43139      openArray("code");
43140      for (CodeableConcept e : element.getCode())
43141        composeCodeableConcept(null, e);
43142      closeArray();
43143    }
43144    ;
43145    if (element.hasDetail()) {
43146      openArray("detail");
43147      for (Reference e : element.getDetail())
43148        composeReference(null, e);
43149      closeArray();
43150    }
43151    ;
43152  }
43153
43154  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name,
43155      DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
43156    if (element != null) {
43157      open(name);
43158      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
43159      close();
43160    }
43161  }
43162
43163  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(
43164      DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
43165    composeBackbone(element);
43166    if (element.hasAction()) {
43167      composeCodeableConcept("action", element.getAction());
43168    }
43169    if (element.hasDateElement()) {
43170      composeDateTimeCore("date", element.getDateElement(), false);
43171      composeDateTimeExtras("date", element.getDateElement(), false);
43172    }
43173    if (element.hasAuthor()) {
43174      composeReference("author", element.getAuthor());
43175    }
43176  }
43177
43178  protected void composeDevice(String name, Device element) throws IOException {
43179    if (element != null) {
43180      prop("resourceType", name);
43181      composeDeviceInner(element);
43182    }
43183  }
43184
43185  protected void composeDeviceInner(Device element) throws IOException {
43186    composeDomainResourceElements(element);
43187    if (element.hasIdentifier()) {
43188      openArray("identifier");
43189      for (Identifier e : element.getIdentifier())
43190        composeIdentifier(null, e);
43191      closeArray();
43192    }
43193    ;
43194    if (element.hasDefinition()) {
43195      composeReference("definition", element.getDefinition());
43196    }
43197    if (element.hasUdiCarrier()) {
43198      openArray("udiCarrier");
43199      for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier())
43200        composeDeviceDeviceUdiCarrierComponent(null, e);
43201      closeArray();
43202    }
43203    ;
43204    if (element.hasStatusElement()) {
43205      composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
43206      composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
43207    }
43208    if (element.hasStatusReason()) {
43209      openArray("statusReason");
43210      for (CodeableConcept e : element.getStatusReason())
43211        composeCodeableConcept(null, e);
43212      closeArray();
43213    }
43214    ;
43215    if (element.hasDistinctIdentifierElement()) {
43216      composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
43217      composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
43218    }
43219    if (element.hasManufacturerElement()) {
43220      composeStringCore("manufacturer", element.getManufacturerElement(), false);
43221      composeStringExtras("manufacturer", element.getManufacturerElement(), false);
43222    }
43223    if (element.hasManufactureDateElement()) {
43224      composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
43225      composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
43226    }
43227    if (element.hasExpirationDateElement()) {
43228      composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
43229      composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
43230    }
43231    if (element.hasLotNumberElement()) {
43232      composeStringCore("lotNumber", element.getLotNumberElement(), false);
43233      composeStringExtras("lotNumber", element.getLotNumberElement(), false);
43234    }
43235    if (element.hasSerialNumberElement()) {
43236      composeStringCore("serialNumber", element.getSerialNumberElement(), false);
43237      composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
43238    }
43239    if (element.hasDeviceName()) {
43240      openArray("deviceName");
43241      for (Device.DeviceDeviceNameComponent e : element.getDeviceName())
43242        composeDeviceDeviceDeviceNameComponent(null, e);
43243      closeArray();
43244    }
43245    ;
43246    if (element.hasModelNumberElement()) {
43247      composeStringCore("modelNumber", element.getModelNumberElement(), false);
43248      composeStringExtras("modelNumber", element.getModelNumberElement(), false);
43249    }
43250    if (element.hasPartNumberElement()) {
43251      composeStringCore("partNumber", element.getPartNumberElement(), false);
43252      composeStringExtras("partNumber", element.getPartNumberElement(), false);
43253    }
43254    if (element.hasType()) {
43255      composeCodeableConcept("type", element.getType());
43256    }
43257    if (element.hasSpecialization()) {
43258      openArray("specialization");
43259      for (Device.DeviceSpecializationComponent e : element.getSpecialization())
43260        composeDeviceDeviceSpecializationComponent(null, e);
43261      closeArray();
43262    }
43263    ;
43264    if (element.hasVersion()) {
43265      openArray("version");
43266      for (Device.DeviceVersionComponent e : element.getVersion())
43267        composeDeviceDeviceVersionComponent(null, e);
43268      closeArray();
43269    }
43270    ;
43271    if (element.hasProperty()) {
43272      openArray("property");
43273      for (Device.DevicePropertyComponent e : element.getProperty())
43274        composeDeviceDevicePropertyComponent(null, e);
43275      closeArray();
43276    }
43277    ;
43278    if (element.hasPatient()) {
43279      composeReference("patient", element.getPatient());
43280    }
43281    if (element.hasOwner()) {
43282      composeReference("owner", element.getOwner());
43283    }
43284    if (element.hasContact()) {
43285      openArray("contact");
43286      for (ContactPoint e : element.getContact())
43287        composeContactPoint(null, e);
43288      closeArray();
43289    }
43290    ;
43291    if (element.hasLocation()) {
43292      composeReference("location", element.getLocation());
43293    }
43294    if (element.hasUrlElement()) {
43295      composeUriCore("url", element.getUrlElement(), false);
43296      composeUriExtras("url", element.getUrlElement(), false);
43297    }
43298    if (element.hasNote()) {
43299      openArray("note");
43300      for (Annotation e : element.getNote())
43301        composeAnnotation(null, e);
43302      closeArray();
43303    }
43304    ;
43305    if (element.hasSafety()) {
43306      openArray("safety");
43307      for (CodeableConcept e : element.getSafety())
43308        composeCodeableConcept(null, e);
43309      closeArray();
43310    }
43311    ;
43312    if (element.hasParent()) {
43313      composeReference("parent", element.getParent());
43314    }
43315  }
43316
43317  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element)
43318      throws IOException {
43319    if (element != null) {
43320      open(name);
43321      composeDeviceDeviceUdiCarrierComponentInner(element);
43322      close();
43323    }
43324  }
43325
43326  protected void composeDeviceDeviceUdiCarrierComponentInner(Device.DeviceUdiCarrierComponent element)
43327      throws IOException {
43328    composeBackbone(element);
43329    if (element.hasDeviceIdentifierElement()) {
43330      composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
43331      composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
43332    }
43333    if (element.hasIssuerElement()) {
43334      composeUriCore("issuer", element.getIssuerElement(), false);
43335      composeUriExtras("issuer", element.getIssuerElement(), false);
43336    }
43337    if (element.hasJurisdictionElement()) {
43338      composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
43339      composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
43340    }
43341    if (element.hasCarrierAIDCElement()) {
43342      composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
43343      composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
43344    }
43345    if (element.hasCarrierHRFElement()) {
43346      composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
43347      composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
43348    }
43349    if (element.hasEntryTypeElement()) {
43350      composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
43351      composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
43352    }
43353  }
43354
43355  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element)
43356      throws IOException {
43357    if (element != null) {
43358      open(name);
43359      composeDeviceDeviceDeviceNameComponentInner(element);
43360      close();
43361    }
43362  }
43363
43364  protected void composeDeviceDeviceDeviceNameComponentInner(Device.DeviceDeviceNameComponent element)
43365      throws IOException {
43366    composeBackbone(element);
43367    if (element.hasNameElement()) {
43368      composeStringCore("name", element.getNameElement(), false);
43369      composeStringExtras("name", element.getNameElement(), false);
43370    }
43371    if (element.hasTypeElement()) {
43372      composeEnumerationCore("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
43373      composeEnumerationExtras("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
43374    }
43375  }
43376
43377  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element)
43378      throws IOException {
43379    if (element != null) {
43380      open(name);
43381      composeDeviceDeviceSpecializationComponentInner(element);
43382      close();
43383    }
43384  }
43385
43386  protected void composeDeviceDeviceSpecializationComponentInner(Device.DeviceSpecializationComponent element)
43387      throws IOException {
43388    composeBackbone(element);
43389    if (element.hasSystemType()) {
43390      composeCodeableConcept("systemType", element.getSystemType());
43391    }
43392    if (element.hasVersionElement()) {
43393      composeStringCore("version", element.getVersionElement(), false);
43394      composeStringExtras("version", element.getVersionElement(), false);
43395    }
43396  }
43397
43398  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element)
43399      throws IOException {
43400    if (element != null) {
43401      open(name);
43402      composeDeviceDeviceVersionComponentInner(element);
43403      close();
43404    }
43405  }
43406
43407  protected void composeDeviceDeviceVersionComponentInner(Device.DeviceVersionComponent element) throws IOException {
43408    composeBackbone(element);
43409    if (element.hasType()) {
43410      composeCodeableConcept("type", element.getType());
43411    }
43412    if (element.hasComponent()) {
43413      composeIdentifier("component", element.getComponent());
43414    }
43415    if (element.hasValueElement()) {
43416      composeStringCore("value", element.getValueElement(), false);
43417      composeStringExtras("value", element.getValueElement(), false);
43418    }
43419  }
43420
43421  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element)
43422      throws IOException {
43423    if (element != null) {
43424      open(name);
43425      composeDeviceDevicePropertyComponentInner(element);
43426      close();
43427    }
43428  }
43429
43430  protected void composeDeviceDevicePropertyComponentInner(Device.DevicePropertyComponent element) throws IOException {
43431    composeBackbone(element);
43432    if (element.hasType()) {
43433      composeCodeableConcept("type", element.getType());
43434    }
43435    if (element.hasValueQuantity()) {
43436      openArray("valueQuantity");
43437      for (Quantity e : element.getValueQuantity())
43438        composeQuantity(null, e);
43439      closeArray();
43440    }
43441    ;
43442    if (element.hasValueCode()) {
43443      openArray("valueCode");
43444      for (CodeableConcept e : element.getValueCode())
43445        composeCodeableConcept(null, e);
43446      closeArray();
43447    }
43448    ;
43449  }
43450
43451  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
43452    if (element != null) {
43453      prop("resourceType", name);
43454      composeDeviceDefinitionInner(element);
43455    }
43456  }
43457
43458  protected void composeDeviceDefinitionInner(DeviceDefinition element) throws IOException {
43459    composeDomainResourceElements(element);
43460    if (element.hasIdentifier()) {
43461      openArray("identifier");
43462      for (Identifier e : element.getIdentifier())
43463        composeIdentifier(null, e);
43464      closeArray();
43465    }
43466    ;
43467    if (element.hasUdiDeviceIdentifier()) {
43468      openArray("udiDeviceIdentifier");
43469      for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier())
43470        composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
43471      closeArray();
43472    }
43473    ;
43474    if (element.hasManufacturer()) {
43475      composeType("manufacturer", element.getManufacturer());
43476    }
43477    if (element.hasDeviceName()) {
43478      openArray("deviceName");
43479      for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName())
43480        composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(null, e);
43481      closeArray();
43482    }
43483    ;
43484    if (element.hasModelNumberElement()) {
43485      composeStringCore("modelNumber", element.getModelNumberElement(), false);
43486      composeStringExtras("modelNumber", element.getModelNumberElement(), false);
43487    }
43488    if (element.hasType()) {
43489      composeCodeableConcept("type", element.getType());
43490    }
43491    if (element.hasSpecialization()) {
43492      openArray("specialization");
43493      for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization())
43494        composeDeviceDefinitionDeviceDefinitionSpecializationComponent(null, e);
43495      closeArray();
43496    }
43497    ;
43498    if (element.hasVersion()) {
43499      openArray("version");
43500      for (StringType e : element.getVersion())
43501        composeStringCore(null, e, true);
43502      closeArray();
43503      if (anyHasExtras(element.getVersion())) {
43504        openArray("_version");
43505        for (StringType e : element.getVersion())
43506          composeStringExtras(null, e, true);
43507        closeArray();
43508      }
43509    }
43510    ;
43511    if (element.hasSafety()) {
43512      openArray("safety");
43513      for (CodeableConcept e : element.getSafety())
43514        composeCodeableConcept(null, e);
43515      closeArray();
43516    }
43517    ;
43518    if (element.hasShelfLifeStorage()) {
43519      openArray("shelfLifeStorage");
43520      for (ProductShelfLife e : element.getShelfLifeStorage())
43521        composeProductShelfLife(null, e);
43522      closeArray();
43523    }
43524    ;
43525    if (element.hasPhysicalCharacteristics()) {
43526      composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
43527    }
43528    if (element.hasLanguageCode()) {
43529      openArray("languageCode");
43530      for (CodeableConcept e : element.getLanguageCode())
43531        composeCodeableConcept(null, e);
43532      closeArray();
43533    }
43534    ;
43535    if (element.hasCapability()) {
43536      openArray("capability");
43537      for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability())
43538        composeDeviceDefinitionDeviceDefinitionCapabilityComponent(null, e);
43539      closeArray();
43540    }
43541    ;
43542    if (element.hasProperty()) {
43543      openArray("property");
43544      for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty())
43545        composeDeviceDefinitionDeviceDefinitionPropertyComponent(null, e);
43546      closeArray();
43547    }
43548    ;
43549    if (element.hasOwner()) {
43550      composeReference("owner", element.getOwner());
43551    }
43552    if (element.hasContact()) {
43553      openArray("contact");
43554      for (ContactPoint e : element.getContact())
43555        composeContactPoint(null, e);
43556      closeArray();
43557    }
43558    ;
43559    if (element.hasUrlElement()) {
43560      composeUriCore("url", element.getUrlElement(), false);
43561      composeUriExtras("url", element.getUrlElement(), false);
43562    }
43563    if (element.hasOnlineInformationElement()) {
43564      composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
43565      composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
43566    }
43567    if (element.hasNote()) {
43568      openArray("note");
43569      for (Annotation e : element.getNote())
43570        composeAnnotation(null, e);
43571      closeArray();
43572    }
43573    ;
43574    if (element.hasQuantity()) {
43575      composeQuantity("quantity", element.getQuantity());
43576    }
43577    if (element.hasParentDevice()) {
43578      composeReference("parentDevice", element.getParentDevice());
43579    }
43580    if (element.hasMaterial()) {
43581      openArray("material");
43582      for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial())
43583        composeDeviceDefinitionDeviceDefinitionMaterialComponent(null, e);
43584      closeArray();
43585    }
43586    ;
43587  }
43588
43589  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name,
43590      DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
43591    if (element != null) {
43592      open(name);
43593      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(element);
43594      close();
43595    }
43596  }
43597
43598  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(
43599      DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
43600    composeBackbone(element);
43601    if (element.hasDeviceIdentifierElement()) {
43602      composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
43603      composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
43604    }
43605    if (element.hasIssuerElement()) {
43606      composeUriCore("issuer", element.getIssuerElement(), false);
43607      composeUriExtras("issuer", element.getIssuerElement(), false);
43608    }
43609    if (element.hasJurisdictionElement()) {
43610      composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
43611      composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
43612    }
43613  }
43614
43615  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name,
43616      DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
43617    if (element != null) {
43618      open(name);
43619      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(element);
43620      close();
43621    }
43622  }
43623
43624  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(
43625      DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
43626    composeBackbone(element);
43627    if (element.hasNameElement()) {
43628      composeStringCore("name", element.getNameElement(), false);
43629      composeStringExtras("name", element.getNameElement(), false);
43630    }
43631    if (element.hasTypeElement()) {
43632      composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
43633      composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(),
43634          false);
43635    }
43636  }
43637
43638  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name,
43639      DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
43640    if (element != null) {
43641      open(name);
43642      composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(element);
43643      close();
43644    }
43645  }
43646
43647  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(
43648      DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
43649    composeBackbone(element);
43650    if (element.hasSystemTypeElement()) {
43651      composeStringCore("systemType", element.getSystemTypeElement(), false);
43652      composeStringExtras("systemType", element.getSystemTypeElement(), false);
43653    }
43654    if (element.hasVersionElement()) {
43655      composeStringCore("version", element.getVersionElement(), false);
43656      composeStringExtras("version", element.getVersionElement(), false);
43657    }
43658  }
43659
43660  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name,
43661      DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
43662    if (element != null) {
43663      open(name);
43664      composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(element);
43665      close();
43666    }
43667  }
43668
43669  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(
43670      DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
43671    composeBackbone(element);
43672    if (element.hasType()) {
43673      composeCodeableConcept("type", element.getType());
43674    }
43675    if (element.hasDescription()) {
43676      openArray("description");
43677      for (CodeableConcept e : element.getDescription())
43678        composeCodeableConcept(null, e);
43679      closeArray();
43680    }
43681    ;
43682  }
43683
43684  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name,
43685      DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
43686    if (element != null) {
43687      open(name);
43688      composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(element);
43689      close();
43690    }
43691  }
43692
43693  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(
43694      DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
43695    composeBackbone(element);
43696    if (element.hasType()) {
43697      composeCodeableConcept("type", element.getType());
43698    }
43699    if (element.hasValueQuantity()) {
43700      openArray("valueQuantity");
43701      for (Quantity e : element.getValueQuantity())
43702        composeQuantity(null, e);
43703      closeArray();
43704    }
43705    ;
43706    if (element.hasValueCode()) {
43707      openArray("valueCode");
43708      for (CodeableConcept e : element.getValueCode())
43709        composeCodeableConcept(null, e);
43710      closeArray();
43711    }
43712    ;
43713  }
43714
43715  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name,
43716      DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
43717    if (element != null) {
43718      open(name);
43719      composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(element);
43720      close();
43721    }
43722  }
43723
43724  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(
43725      DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
43726    composeBackbone(element);
43727    if (element.hasSubstance()) {
43728      composeCodeableConcept("substance", element.getSubstance());
43729    }
43730    if (element.hasAlternateElement()) {
43731      composeBooleanCore("alternate", element.getAlternateElement(), false);
43732      composeBooleanExtras("alternate", element.getAlternateElement(), false);
43733    }
43734    if (element.hasAllergenicIndicatorElement()) {
43735      composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
43736      composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
43737    }
43738  }
43739
43740  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
43741    if (element != null) {
43742      prop("resourceType", name);
43743      composeDeviceMetricInner(element);
43744    }
43745  }
43746
43747  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
43748    composeDomainResourceElements(element);
43749    if (element.hasIdentifier()) {
43750      openArray("identifier");
43751      for (Identifier e : element.getIdentifier())
43752        composeIdentifier(null, e);
43753      closeArray();
43754    }
43755    ;
43756    if (element.hasType()) {
43757      composeCodeableConcept("type", element.getType());
43758    }
43759    if (element.hasUnit()) {
43760      composeCodeableConcept("unit", element.getUnit());
43761    }
43762    if (element.hasSource()) {
43763      composeReference("source", element.getSource());
43764    }
43765    if (element.hasParent()) {
43766      composeReference("parent", element.getParent());
43767    }
43768    if (element.hasOperationalStatusElement()) {
43769      composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(),
43770          new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
43771      composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(),
43772          new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
43773    }
43774    if (element.hasColorElement()) {
43775      composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(),
43776          false);
43777      composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(),
43778          false);
43779    }
43780    if (element.hasCategoryElement()) {
43781      composeEnumerationCore("category", element.getCategoryElement(),
43782          new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
43783      composeEnumerationExtras("category", element.getCategoryElement(),
43784          new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
43785    }
43786    if (element.hasMeasurementPeriod()) {
43787      composeTiming("measurementPeriod", element.getMeasurementPeriod());
43788    }
43789    if (element.hasCalibration()) {
43790      openArray("calibration");
43791      for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration())
43792        composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
43793      closeArray();
43794    }
43795    ;
43796  }
43797
43798  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name,
43799      DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
43800    if (element != null) {
43801      open(name);
43802      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
43803      close();
43804    }
43805  }
43806
43807  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(
43808      DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
43809    composeBackbone(element);
43810    if (element.hasTypeElement()) {
43811      composeEnumerationCore("type", element.getTypeElement(),
43812          new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
43813      composeEnumerationExtras("type", element.getTypeElement(),
43814          new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
43815    }
43816    if (element.hasStateElement()) {
43817      composeEnumerationCore("state", element.getStateElement(),
43818          new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
43819      composeEnumerationExtras("state", element.getStateElement(),
43820          new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
43821    }
43822    if (element.hasTimeElement()) {
43823      composeInstantCore("time", element.getTimeElement(), false);
43824      composeInstantExtras("time", element.getTimeElement(), false);
43825    }
43826  }
43827
43828  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
43829    if (element != null) {
43830      prop("resourceType", name);
43831      composeDeviceRequestInner(element);
43832    }
43833  }
43834
43835  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
43836    composeDomainResourceElements(element);
43837    if (element.hasIdentifier()) {
43838      openArray("identifier");
43839      for (Identifier e : element.getIdentifier())
43840        composeIdentifier(null, e);
43841      closeArray();
43842    }
43843    ;
43844    if (element.hasInstantiatesCanonical()) {
43845      openArray("instantiatesCanonical");
43846      for (CanonicalType e : element.getInstantiatesCanonical())
43847        composeCanonicalCore(null, e, true);
43848      closeArray();
43849      if (anyHasExtras(element.getInstantiatesCanonical())) {
43850        openArray("_instantiatesCanonical");
43851        for (CanonicalType e : element.getInstantiatesCanonical())
43852          composeCanonicalExtras(null, e, true);
43853        closeArray();
43854      }
43855    }
43856    ;
43857    if (element.hasInstantiatesUri()) {
43858      openArray("instantiatesUri");
43859      for (UriType e : element.getInstantiatesUri())
43860        composeUriCore(null, e, true);
43861      closeArray();
43862      if (anyHasExtras(element.getInstantiatesUri())) {
43863        openArray("_instantiatesUri");
43864        for (UriType e : element.getInstantiatesUri())
43865          composeUriExtras(null, e, true);
43866        closeArray();
43867      }
43868    }
43869    ;
43870    if (element.hasBasedOn()) {
43871      openArray("basedOn");
43872      for (Reference e : element.getBasedOn())
43873        composeReference(null, e);
43874      closeArray();
43875    }
43876    ;
43877    if (element.hasPriorRequest()) {
43878      openArray("priorRequest");
43879      for (Reference e : element.getPriorRequest())
43880        composeReference(null, e);
43881      closeArray();
43882    }
43883    ;
43884    if (element.hasGroupIdentifier()) {
43885      composeIdentifier("groupIdentifier", element.getGroupIdentifier());
43886    }
43887    if (element.hasStatusElement()) {
43888      composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(),
43889          false);
43890      composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(),
43891          false);
43892    }
43893    if (element.hasIntentElement()) {
43894      composeEnumerationCore("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
43895      composeEnumerationExtras("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(),
43896          false);
43897    }
43898    if (element.hasPriorityElement()) {
43899      composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(),
43900          false);
43901      composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(),
43902          false);
43903    }
43904    if (element.hasCode()) {
43905      composeType("code", element.getCode());
43906    }
43907    if (element.hasParameter()) {
43908      openArray("parameter");
43909      for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter())
43910        composeDeviceRequestDeviceRequestParameterComponent(null, e);
43911      closeArray();
43912    }
43913    ;
43914    if (element.hasSubject()) {
43915      composeReference("subject", element.getSubject());
43916    }
43917    if (element.hasEncounter()) {
43918      composeReference("encounter", element.getEncounter());
43919    }
43920    if (element.hasOccurrence()) {
43921      composeType("occurrence", element.getOccurrence());
43922    }
43923    if (element.hasAuthoredOnElement()) {
43924      composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
43925      composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
43926    }
43927    if (element.hasRequester()) {
43928      composeReference("requester", element.getRequester());
43929    }
43930    if (element.hasPerformerType()) {
43931      composeCodeableConcept("performerType", element.getPerformerType());
43932    }
43933    if (element.hasPerformer()) {
43934      composeReference("performer", element.getPerformer());
43935    }
43936    if (element.hasReasonCode()) {
43937      openArray("reasonCode");
43938      for (CodeableConcept e : element.getReasonCode())
43939        composeCodeableConcept(null, e);
43940      closeArray();
43941    }
43942    ;
43943    if (element.hasReasonReference()) {
43944      openArray("reasonReference");
43945      for (Reference e : element.getReasonReference())
43946        composeReference(null, e);
43947      closeArray();
43948    }
43949    ;
43950    if (element.hasInsurance()) {
43951      openArray("insurance");
43952      for (Reference e : element.getInsurance())
43953        composeReference(null, e);
43954      closeArray();
43955    }
43956    ;
43957    if (element.hasSupportingInfo()) {
43958      openArray("supportingInfo");
43959      for (Reference e : element.getSupportingInfo())
43960        composeReference(null, e);
43961      closeArray();
43962    }
43963    ;
43964    if (element.hasNote()) {
43965      openArray("note");
43966      for (Annotation e : element.getNote())
43967        composeAnnotation(null, e);
43968      closeArray();
43969    }
43970    ;
43971    if (element.hasRelevantHistory()) {
43972      openArray("relevantHistory");
43973      for (Reference e : element.getRelevantHistory())
43974        composeReference(null, e);
43975      closeArray();
43976    }
43977    ;
43978  }
43979
43980  protected void composeDeviceRequestDeviceRequestParameterComponent(String name,
43981      DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
43982    if (element != null) {
43983      open(name);
43984      composeDeviceRequestDeviceRequestParameterComponentInner(element);
43985      close();
43986    }
43987  }
43988
43989  protected void composeDeviceRequestDeviceRequestParameterComponentInner(
43990      DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
43991    composeBackbone(element);
43992    if (element.hasCode()) {
43993      composeCodeableConcept("code", element.getCode());
43994    }
43995    if (element.hasValue()) {
43996      composeType("value", element.getValue());
43997    }
43998  }
43999
44000  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
44001    if (element != null) {
44002      prop("resourceType", name);
44003      composeDeviceUseStatementInner(element);
44004    }
44005  }
44006
44007  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
44008    composeDomainResourceElements(element);
44009    if (element.hasIdentifier()) {
44010      openArray("identifier");
44011      for (Identifier e : element.getIdentifier())
44012        composeIdentifier(null, e);
44013      closeArray();
44014    }
44015    ;
44016    if (element.hasBasedOn()) {
44017      openArray("basedOn");
44018      for (Reference e : element.getBasedOn())
44019        composeReference(null, e);
44020      closeArray();
44021    }
44022    ;
44023    if (element.hasStatusElement()) {
44024      composeEnumerationCore("status", element.getStatusElement(),
44025          new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
44026      composeEnumerationExtras("status", element.getStatusElement(),
44027          new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
44028    }
44029    if (element.hasSubject()) {
44030      composeReference("subject", element.getSubject());
44031    }
44032    if (element.hasDerivedFrom()) {
44033      openArray("derivedFrom");
44034      for (Reference e : element.getDerivedFrom())
44035        composeReference(null, e);
44036      closeArray();
44037    }
44038    ;
44039    if (element.hasTiming()) {
44040      composeType("timing", element.getTiming());
44041    }
44042    if (element.hasRecordedOnElement()) {
44043      composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
44044      composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
44045    }
44046    if (element.hasSource()) {
44047      composeReference("source", element.getSource());
44048    }
44049    if (element.hasDevice()) {
44050      composeReference("device", element.getDevice());
44051    }
44052    if (element.hasReasonCode()) {
44053      openArray("reasonCode");
44054      for (CodeableConcept e : element.getReasonCode())
44055        composeCodeableConcept(null, e);
44056      closeArray();
44057    }
44058    ;
44059    if (element.hasReasonReference()) {
44060      openArray("reasonReference");
44061      for (Reference e : element.getReasonReference())
44062        composeReference(null, e);
44063      closeArray();
44064    }
44065    ;
44066    if (element.hasBodySite()) {
44067      composeCodeableConcept("bodySite", element.getBodySite());
44068    }
44069    if (element.hasNote()) {
44070      openArray("note");
44071      for (Annotation e : element.getNote())
44072        composeAnnotation(null, e);
44073      closeArray();
44074    }
44075    ;
44076  }
44077
44078  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
44079    if (element != null) {
44080      prop("resourceType", name);
44081      composeDiagnosticReportInner(element);
44082    }
44083  }
44084
44085  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
44086    composeDomainResourceElements(element);
44087    if (element.hasIdentifier()) {
44088      openArray("identifier");
44089      for (Identifier e : element.getIdentifier())
44090        composeIdentifier(null, e);
44091      closeArray();
44092    }
44093    ;
44094    if (element.hasBasedOn()) {
44095      openArray("basedOn");
44096      for (Reference e : element.getBasedOn())
44097        composeReference(null, e);
44098      closeArray();
44099    }
44100    ;
44101    if (element.hasStatusElement()) {
44102      composeEnumerationCore("status", element.getStatusElement(),
44103          new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
44104      composeEnumerationExtras("status", element.getStatusElement(),
44105          new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
44106    }
44107    if (element.hasCategory()) {
44108      openArray("category");
44109      for (CodeableConcept e : element.getCategory())
44110        composeCodeableConcept(null, e);
44111      closeArray();
44112    }
44113    ;
44114    if (element.hasCode()) {
44115      composeCodeableConcept("code", element.getCode());
44116    }
44117    if (element.hasSubject()) {
44118      composeReference("subject", element.getSubject());
44119    }
44120    if (element.hasEncounter()) {
44121      composeReference("encounter", element.getEncounter());
44122    }
44123    if (element.hasEffective()) {
44124      composeType("effective", element.getEffective());
44125    }
44126    if (element.hasIssuedElement()) {
44127      composeInstantCore("issued", element.getIssuedElement(), false);
44128      composeInstantExtras("issued", element.getIssuedElement(), false);
44129    }
44130    if (element.hasPerformer()) {
44131      openArray("performer");
44132      for (Reference e : element.getPerformer())
44133        composeReference(null, e);
44134      closeArray();
44135    }
44136    ;
44137    if (element.hasResultsInterpreter()) {
44138      openArray("resultsInterpreter");
44139      for (Reference e : element.getResultsInterpreter())
44140        composeReference(null, e);
44141      closeArray();
44142    }
44143    ;
44144    if (element.hasSpecimen()) {
44145      openArray("specimen");
44146      for (Reference e : element.getSpecimen())
44147        composeReference(null, e);
44148      closeArray();
44149    }
44150    ;
44151    if (element.hasResult()) {
44152      openArray("result");
44153      for (Reference e : element.getResult())
44154        composeReference(null, e);
44155      closeArray();
44156    }
44157    ;
44158    if (element.hasImagingStudy()) {
44159      openArray("imagingStudy");
44160      for (Reference e : element.getImagingStudy())
44161        composeReference(null, e);
44162      closeArray();
44163    }
44164    ;
44165    if (element.hasMedia()) {
44166      openArray("media");
44167      for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia())
44168        composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
44169      closeArray();
44170    }
44171    ;
44172    if (element.hasConclusionElement()) {
44173      composeStringCore("conclusion", element.getConclusionElement(), false);
44174      composeStringExtras("conclusion", element.getConclusionElement(), false);
44175    }
44176    if (element.hasConclusionCode()) {
44177      openArray("conclusionCode");
44178      for (CodeableConcept e : element.getConclusionCode())
44179        composeCodeableConcept(null, e);
44180      closeArray();
44181    }
44182    ;
44183    if (element.hasPresentedForm()) {
44184      openArray("presentedForm");
44185      for (Attachment e : element.getPresentedForm())
44186        composeAttachment(null, e);
44187      closeArray();
44188    }
44189    ;
44190  }
44191
44192  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name,
44193      DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
44194    if (element != null) {
44195      open(name);
44196      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
44197      close();
44198    }
44199  }
44200
44201  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(
44202      DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
44203    composeBackbone(element);
44204    if (element.hasCommentElement()) {
44205      composeStringCore("comment", element.getCommentElement(), false);
44206      composeStringExtras("comment", element.getCommentElement(), false);
44207    }
44208    if (element.hasLink()) {
44209      composeReference("link", element.getLink());
44210    }
44211  }
44212
44213  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
44214    if (element != null) {
44215      prop("resourceType", name);
44216      composeDocumentManifestInner(element);
44217    }
44218  }
44219
44220  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
44221    composeDomainResourceElements(element);
44222    if (element.hasMasterIdentifier()) {
44223      composeIdentifier("masterIdentifier", element.getMasterIdentifier());
44224    }
44225    if (element.hasIdentifier()) {
44226      openArray("identifier");
44227      for (Identifier e : element.getIdentifier())
44228        composeIdentifier(null, e);
44229      closeArray();
44230    }
44231    ;
44232    if (element.hasStatusElement()) {
44233      composeEnumerationCore("status", element.getStatusElement(),
44234          new Enumerations.DocumentReferenceStatusEnumFactory(), false);
44235      composeEnumerationExtras("status", element.getStatusElement(),
44236          new Enumerations.DocumentReferenceStatusEnumFactory(), false);
44237    }
44238    if (element.hasType()) {
44239      composeCodeableConcept("type", element.getType());
44240    }
44241    if (element.hasSubject()) {
44242      composeReference("subject", element.getSubject());
44243    }
44244    if (element.hasCreatedElement()) {
44245      composeDateTimeCore("created", element.getCreatedElement(), false);
44246      composeDateTimeExtras("created", element.getCreatedElement(), false);
44247    }
44248    if (element.hasAuthor()) {
44249      openArray("author");
44250      for (Reference e : element.getAuthor())
44251        composeReference(null, e);
44252      closeArray();
44253    }
44254    ;
44255    if (element.hasRecipient()) {
44256      openArray("recipient");
44257      for (Reference e : element.getRecipient())
44258        composeReference(null, e);
44259      closeArray();
44260    }
44261    ;
44262    if (element.hasSourceElement()) {
44263      composeUriCore("source", element.getSourceElement(), false);
44264      composeUriExtras("source", element.getSourceElement(), false);
44265    }
44266    if (element.hasDescriptionElement()) {
44267      composeStringCore("description", element.getDescriptionElement(), false);
44268      composeStringExtras("description", element.getDescriptionElement(), false);
44269    }
44270    if (element.hasContent()) {
44271      openArray("content");
44272      for (Reference e : element.getContent())
44273        composeReference(null, e);
44274      closeArray();
44275    }
44276    ;
44277    if (element.hasRelated()) {
44278      openArray("related");
44279      for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated())
44280        composeDocumentManifestDocumentManifestRelatedComponent(null, e);
44281      closeArray();
44282    }
44283    ;
44284  }
44285
44286  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name,
44287      DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
44288    if (element != null) {
44289      open(name);
44290      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
44291      close();
44292    }
44293  }
44294
44295  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(
44296      DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
44297    composeBackbone(element);
44298    if (element.hasIdentifier()) {
44299      composeIdentifier("identifier", element.getIdentifier());
44300    }
44301    if (element.hasRef()) {
44302      composeReference("ref", element.getRef());
44303    }
44304  }
44305
44306  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
44307    if (element != null) {
44308      prop("resourceType", name);
44309      composeDocumentReferenceInner(element);
44310    }
44311  }
44312
44313  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
44314    composeDomainResourceElements(element);
44315    if (element.hasMasterIdentifier()) {
44316      composeIdentifier("masterIdentifier", element.getMasterIdentifier());
44317    }
44318    if (element.hasIdentifier()) {
44319      openArray("identifier");
44320      for (Identifier e : element.getIdentifier())
44321        composeIdentifier(null, e);
44322      closeArray();
44323    }
44324    ;
44325    if (element.hasStatusElement()) {
44326      composeEnumerationCore("status", element.getStatusElement(),
44327          new Enumerations.DocumentReferenceStatusEnumFactory(), false);
44328      composeEnumerationExtras("status", element.getStatusElement(),
44329          new Enumerations.DocumentReferenceStatusEnumFactory(), false);
44330    }
44331    if (element.hasDocStatusElement()) {
44332      composeEnumerationCore("docStatus", element.getDocStatusElement(),
44333          new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
44334      composeEnumerationExtras("docStatus", element.getDocStatusElement(),
44335          new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
44336    }
44337    if (element.hasType()) {
44338      composeCodeableConcept("type", element.getType());
44339    }
44340    if (element.hasCategory()) {
44341      openArray("category");
44342      for (CodeableConcept e : element.getCategory())
44343        composeCodeableConcept(null, e);
44344      closeArray();
44345    }
44346    ;
44347    if (element.hasSubject()) {
44348      composeReference("subject", element.getSubject());
44349    }
44350    if (element.hasDateElement()) {
44351      composeInstantCore("date", element.getDateElement(), false);
44352      composeInstantExtras("date", element.getDateElement(), false);
44353    }
44354    if (element.hasAuthor()) {
44355      openArray("author");
44356      for (Reference e : element.getAuthor())
44357        composeReference(null, e);
44358      closeArray();
44359    }
44360    ;
44361    if (element.hasAuthenticator()) {
44362      composeReference("authenticator", element.getAuthenticator());
44363    }
44364    if (element.hasCustodian()) {
44365      composeReference("custodian", element.getCustodian());
44366    }
44367    if (element.hasRelatesTo()) {
44368      openArray("relatesTo");
44369      for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo())
44370        composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
44371      closeArray();
44372    }
44373    ;
44374    if (element.hasDescriptionElement()) {
44375      composeStringCore("description", element.getDescriptionElement(), false);
44376      composeStringExtras("description", element.getDescriptionElement(), false);
44377    }
44378    if (element.hasSecurityLabel()) {
44379      openArray("securityLabel");
44380      for (CodeableConcept e : element.getSecurityLabel())
44381        composeCodeableConcept(null, e);
44382      closeArray();
44383    }
44384    ;
44385    if (element.hasContent()) {
44386      openArray("content");
44387      for (DocumentReference.DocumentReferenceContentComponent e : element.getContent())
44388        composeDocumentReferenceDocumentReferenceContentComponent(null, e);
44389      closeArray();
44390    }
44391    ;
44392    if (element.hasContext()) {
44393      composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
44394    }
44395  }
44396
44397  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name,
44398      DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
44399    if (element != null) {
44400      open(name);
44401      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
44402      close();
44403    }
44404  }
44405
44406  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(
44407      DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
44408    composeBackbone(element);
44409    if (element.hasCodeElement()) {
44410      composeEnumerationCore("code", element.getCodeElement(),
44411          new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
44412      composeEnumerationExtras("code", element.getCodeElement(),
44413          new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
44414    }
44415    if (element.hasTarget()) {
44416      composeReference("target", element.getTarget());
44417    }
44418  }
44419
44420  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name,
44421      DocumentReference.DocumentReferenceContentComponent element) throws IOException {
44422    if (element != null) {
44423      open(name);
44424      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
44425      close();
44426    }
44427  }
44428
44429  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(
44430      DocumentReference.DocumentReferenceContentComponent element) throws IOException {
44431    composeBackbone(element);
44432    if (element.hasAttachment()) {
44433      composeAttachment("attachment", element.getAttachment());
44434    }
44435    if (element.hasFormat()) {
44436      composeCoding("format", element.getFormat());
44437    }
44438  }
44439
44440  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name,
44441      DocumentReference.DocumentReferenceContextComponent element) throws IOException {
44442    if (element != null) {
44443      open(name);
44444      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
44445      close();
44446    }
44447  }
44448
44449  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(
44450      DocumentReference.DocumentReferenceContextComponent element) throws IOException {
44451    composeBackbone(element);
44452    if (element.hasEncounter()) {
44453      openArray("encounter");
44454      for (Reference e : element.getEncounter())
44455        composeReference(null, e);
44456      closeArray();
44457    }
44458    ;
44459    if (element.hasEvent()) {
44460      openArray("event");
44461      for (CodeableConcept e : element.getEvent())
44462        composeCodeableConcept(null, e);
44463      closeArray();
44464    }
44465    ;
44466    if (element.hasPeriod()) {
44467      composePeriod("period", element.getPeriod());
44468    }
44469    if (element.hasFacilityType()) {
44470      composeCodeableConcept("facilityType", element.getFacilityType());
44471    }
44472    if (element.hasPracticeSetting()) {
44473      composeCodeableConcept("practiceSetting", element.getPracticeSetting());
44474    }
44475    if (element.hasSourcePatientInfo()) {
44476      composeReference("sourcePatientInfo", element.getSourcePatientInfo());
44477    }
44478    if (element.hasRelated()) {
44479      openArray("related");
44480      for (Reference e : element.getRelated())
44481        composeReference(null, e);
44482      closeArray();
44483    }
44484    ;
44485  }
44486
44487  protected void composeEffectEvidenceSynthesis(String name, EffectEvidenceSynthesis element) throws IOException {
44488    if (element != null) {
44489      prop("resourceType", name);
44490      composeEffectEvidenceSynthesisInner(element);
44491    }
44492  }
44493
44494  protected void composeEffectEvidenceSynthesisInner(EffectEvidenceSynthesis element) throws IOException {
44495    composeDomainResourceElements(element);
44496    if (element.hasUrlElement()) {
44497      composeUriCore("url", element.getUrlElement(), false);
44498      composeUriExtras("url", element.getUrlElement(), false);
44499    }
44500    if (element.hasIdentifier()) {
44501      openArray("identifier");
44502      for (Identifier e : element.getIdentifier())
44503        composeIdentifier(null, e);
44504      closeArray();
44505    }
44506    ;
44507    if (element.hasVersionElement()) {
44508      composeStringCore("version", element.getVersionElement(), false);
44509      composeStringExtras("version", element.getVersionElement(), false);
44510    }
44511    if (element.hasNameElement()) {
44512      composeStringCore("name", element.getNameElement(), false);
44513      composeStringExtras("name", element.getNameElement(), false);
44514    }
44515    if (element.hasTitleElement()) {
44516      composeStringCore("title", element.getTitleElement(), false);
44517      composeStringExtras("title", element.getTitleElement(), false);
44518    }
44519    if (element.hasStatusElement()) {
44520      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
44521          false);
44522      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
44523          false);
44524    }
44525    if (element.hasDateElement()) {
44526      composeDateTimeCore("date", element.getDateElement(), false);
44527      composeDateTimeExtras("date", element.getDateElement(), false);
44528    }
44529    if (element.hasPublisherElement()) {
44530      composeStringCore("publisher", element.getPublisherElement(), false);
44531      composeStringExtras("publisher", element.getPublisherElement(), false);
44532    }
44533    if (element.hasContact()) {
44534      openArray("contact");
44535      for (ContactDetail e : element.getContact())
44536        composeContactDetail(null, e);
44537      closeArray();
44538    }
44539    ;
44540    if (element.hasDescriptionElement()) {
44541      composeMarkdownCore("description", element.getDescriptionElement(), false);
44542      composeMarkdownExtras("description", element.getDescriptionElement(), false);
44543    }
44544    if (element.hasNote()) {
44545      openArray("note");
44546      for (Annotation e : element.getNote())
44547        composeAnnotation(null, e);
44548      closeArray();
44549    }
44550    ;
44551    if (element.hasUseContext()) {
44552      openArray("useContext");
44553      for (UsageContext e : element.getUseContext())
44554        composeUsageContext(null, e);
44555      closeArray();
44556    }
44557    ;
44558    if (element.hasJurisdiction()) {
44559      openArray("jurisdiction");
44560      for (CodeableConcept e : element.getJurisdiction())
44561        composeCodeableConcept(null, e);
44562      closeArray();
44563    }
44564    ;
44565    if (element.hasCopyrightElement()) {
44566      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44567      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44568    }
44569    if (element.hasApprovalDateElement()) {
44570      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44571      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44572    }
44573    if (element.hasLastReviewDateElement()) {
44574      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44575      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44576    }
44577    if (element.hasEffectivePeriod()) {
44578      composePeriod("effectivePeriod", element.getEffectivePeriod());
44579    }
44580    if (element.hasTopic()) {
44581      openArray("topic");
44582      for (CodeableConcept e : element.getTopic())
44583        composeCodeableConcept(null, e);
44584      closeArray();
44585    }
44586    ;
44587    if (element.hasAuthor()) {
44588      openArray("author");
44589      for (ContactDetail e : element.getAuthor())
44590        composeContactDetail(null, e);
44591      closeArray();
44592    }
44593    ;
44594    if (element.hasEditor()) {
44595      openArray("editor");
44596      for (ContactDetail e : element.getEditor())
44597        composeContactDetail(null, e);
44598      closeArray();
44599    }
44600    ;
44601    if (element.hasReviewer()) {
44602      openArray("reviewer");
44603      for (ContactDetail e : element.getReviewer())
44604        composeContactDetail(null, e);
44605      closeArray();
44606    }
44607    ;
44608    if (element.hasEndorser()) {
44609      openArray("endorser");
44610      for (ContactDetail e : element.getEndorser())
44611        composeContactDetail(null, e);
44612      closeArray();
44613    }
44614    ;
44615    if (element.hasRelatedArtifact()) {
44616      openArray("relatedArtifact");
44617      for (RelatedArtifact e : element.getRelatedArtifact())
44618        composeRelatedArtifact(null, e);
44619      closeArray();
44620    }
44621    ;
44622    if (element.hasSynthesisType()) {
44623      composeCodeableConcept("synthesisType", element.getSynthesisType());
44624    }
44625    if (element.hasStudyType()) {
44626      composeCodeableConcept("studyType", element.getStudyType());
44627    }
44628    if (element.hasPopulation()) {
44629      composeReference("population", element.getPopulation());
44630    }
44631    if (element.hasExposure()) {
44632      composeReference("exposure", element.getExposure());
44633    }
44634    if (element.hasExposureAlternative()) {
44635      composeReference("exposureAlternative", element.getExposureAlternative());
44636    }
44637    if (element.hasOutcome()) {
44638      composeReference("outcome", element.getOutcome());
44639    }
44640    if (element.hasSampleSize()) {
44641      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
44642    }
44643    if (element.hasResultsByExposure()) {
44644      openArray("resultsByExposure");
44645      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent e : element.getResultsByExposure())
44646        composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(null, e);
44647      closeArray();
44648    }
44649    ;
44650    if (element.hasEffectEstimate()) {
44651      openArray("effectEstimate");
44652      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent e : element.getEffectEstimate())
44653        composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(null, e);
44654      closeArray();
44655    }
44656    ;
44657    if (element.hasCertainty()) {
44658      openArray("certainty");
44659      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent e : element.getCertainty())
44660        composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(null, e);
44661      closeArray();
44662    }
44663    ;
44664  }
44665
44666  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(String name,
44667      EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
44668    if (element != null) {
44669      open(name);
44670      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(element);
44671      close();
44672    }
44673  }
44674
44675  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(
44676      EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
44677    composeBackbone(element);
44678    if (element.hasDescriptionElement()) {
44679      composeStringCore("description", element.getDescriptionElement(), false);
44680      composeStringExtras("description", element.getDescriptionElement(), false);
44681    }
44682    if (element.hasNumberOfStudiesElement()) {
44683      composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
44684      composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
44685    }
44686    if (element.hasNumberOfParticipantsElement()) {
44687      composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
44688      composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
44689    }
44690  }
44691
44692  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(String name,
44693      EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
44694    if (element != null) {
44695      open(name);
44696      composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(element);
44697      close();
44698    }
44699  }
44700
44701  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(
44702      EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
44703    composeBackbone(element);
44704    if (element.hasDescriptionElement()) {
44705      composeStringCore("description", element.getDescriptionElement(), false);
44706      composeStringExtras("description", element.getDescriptionElement(), false);
44707    }
44708    if (element.hasExposureStateElement()) {
44709      composeEnumerationCore("exposureState", element.getExposureStateElement(),
44710          new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
44711      composeEnumerationExtras("exposureState", element.getExposureStateElement(),
44712          new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
44713    }
44714    if (element.hasVariantState()) {
44715      composeCodeableConcept("variantState", element.getVariantState());
44716    }
44717    if (element.hasRiskEvidenceSynthesis()) {
44718      composeReference("riskEvidenceSynthesis", element.getRiskEvidenceSynthesis());
44719    }
44720  }
44721
44722  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(String name,
44723      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
44724    if (element != null) {
44725      open(name);
44726      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(element);
44727      close();
44728    }
44729  }
44730
44731  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(
44732      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
44733    composeBackbone(element);
44734    if (element.hasDescriptionElement()) {
44735      composeStringCore("description", element.getDescriptionElement(), false);
44736      composeStringExtras("description", element.getDescriptionElement(), false);
44737    }
44738    if (element.hasType()) {
44739      composeCodeableConcept("type", element.getType());
44740    }
44741    if (element.hasVariantState()) {
44742      composeCodeableConcept("variantState", element.getVariantState());
44743    }
44744    if (element.hasValueElement()) {
44745      composeDecimalCore("value", element.getValueElement(), false);
44746      composeDecimalExtras("value", element.getValueElement(), false);
44747    }
44748    if (element.hasUnitOfMeasure()) {
44749      composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
44750    }
44751    if (element.hasPrecisionEstimate()) {
44752      openArray("precisionEstimate");
44753      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent e : element
44754          .getPrecisionEstimate())
44755        composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(null, e);
44756      closeArray();
44757    }
44758    ;
44759  }
44760
44761  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(
44762      String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element)
44763      throws IOException {
44764    if (element != null) {
44765      open(name);
44766      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(element);
44767      close();
44768    }
44769  }
44770
44771  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(
44772      EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element)
44773      throws IOException {
44774    composeBackbone(element);
44775    if (element.hasType()) {
44776      composeCodeableConcept("type", element.getType());
44777    }
44778    if (element.hasLevelElement()) {
44779      composeDecimalCore("level", element.getLevelElement(), false);
44780      composeDecimalExtras("level", element.getLevelElement(), false);
44781    }
44782    if (element.hasFromElement()) {
44783      composeDecimalCore("from", element.getFromElement(), false);
44784      composeDecimalExtras("from", element.getFromElement(), false);
44785    }
44786    if (element.hasToElement()) {
44787      composeDecimalCore("to", element.getToElement(), false);
44788      composeDecimalExtras("to", element.getToElement(), false);
44789    }
44790  }
44791
44792  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(String name,
44793      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
44794    if (element != null) {
44795      open(name);
44796      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(element);
44797      close();
44798    }
44799  }
44800
44801  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(
44802      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
44803    composeBackbone(element);
44804    if (element.hasRating()) {
44805      openArray("rating");
44806      for (CodeableConcept e : element.getRating())
44807        composeCodeableConcept(null, e);
44808      closeArray();
44809    }
44810    ;
44811    if (element.hasNote()) {
44812      openArray("note");
44813      for (Annotation e : element.getNote())
44814        composeAnnotation(null, e);
44815      closeArray();
44816    }
44817    ;
44818    if (element.hasCertaintySubcomponent()) {
44819      openArray("certaintySubcomponent");
44820      for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element
44821          .getCertaintySubcomponent())
44822        composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
44823      closeArray();
44824    }
44825    ;
44826  }
44827
44828  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(
44829      String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element)
44830      throws IOException {
44831    if (element != null) {
44832      open(name);
44833      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
44834      close();
44835    }
44836  }
44837
44838  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(
44839      EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element)
44840      throws IOException {
44841    composeBackbone(element);
44842    if (element.hasType()) {
44843      composeCodeableConcept("type", element.getType());
44844    }
44845    if (element.hasRating()) {
44846      openArray("rating");
44847      for (CodeableConcept e : element.getRating())
44848        composeCodeableConcept(null, e);
44849      closeArray();
44850    }
44851    ;
44852    if (element.hasNote()) {
44853      openArray("note");
44854      for (Annotation e : element.getNote())
44855        composeAnnotation(null, e);
44856      closeArray();
44857    }
44858    ;
44859  }
44860
44861  protected void composeEncounter(String name, Encounter element) throws IOException {
44862    if (element != null) {
44863      prop("resourceType", name);
44864      composeEncounterInner(element);
44865    }
44866  }
44867
44868  protected void composeEncounterInner(Encounter element) throws IOException {
44869    composeDomainResourceElements(element);
44870    if (element.hasIdentifier()) {
44871      openArray("identifier");
44872      for (Identifier e : element.getIdentifier())
44873        composeIdentifier(null, e);
44874      closeArray();
44875    }
44876    ;
44877    if (element.hasStatusElement()) {
44878      composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
44879      composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
44880    }
44881    if (element.hasStatusHistory()) {
44882      openArray("statusHistory");
44883      for (Encounter.StatusHistoryComponent e : element.getStatusHistory())
44884        composeEncounterStatusHistoryComponent(null, e);
44885      closeArray();
44886    }
44887    ;
44888    if (element.hasClass_()) {
44889      composeCoding("class", element.getClass_());
44890    }
44891    if (element.hasClassHistory()) {
44892      openArray("classHistory");
44893      for (Encounter.ClassHistoryComponent e : element.getClassHistory())
44894        composeEncounterClassHistoryComponent(null, e);
44895      closeArray();
44896    }
44897    ;
44898    if (element.hasType()) {
44899      openArray("type");
44900      for (CodeableConcept e : element.getType())
44901        composeCodeableConcept(null, e);
44902      closeArray();
44903    }
44904    ;
44905    if (element.hasServiceType()) {
44906      composeCodeableConcept("serviceType", element.getServiceType());
44907    }
44908    if (element.hasPriority()) {
44909      composeCodeableConcept("priority", element.getPriority());
44910    }
44911    if (element.hasSubject()) {
44912      composeReference("subject", element.getSubject());
44913    }
44914    if (element.hasEpisodeOfCare()) {
44915      openArray("episodeOfCare");
44916      for (Reference e : element.getEpisodeOfCare())
44917        composeReference(null, e);
44918      closeArray();
44919    }
44920    ;
44921    if (element.hasBasedOn()) {
44922      openArray("basedOn");
44923      for (Reference e : element.getBasedOn())
44924        composeReference(null, e);
44925      closeArray();
44926    }
44927    ;
44928    if (element.hasParticipant()) {
44929      openArray("participant");
44930      for (Encounter.EncounterParticipantComponent e : element.getParticipant())
44931        composeEncounterEncounterParticipantComponent(null, e);
44932      closeArray();
44933    }
44934    ;
44935    if (element.hasAppointment()) {
44936      openArray("appointment");
44937      for (Reference e : element.getAppointment())
44938        composeReference(null, e);
44939      closeArray();
44940    }
44941    ;
44942    if (element.hasPeriod()) {
44943      composePeriod("period", element.getPeriod());
44944    }
44945    if (element.hasLength()) {
44946      composeDuration("length", element.getLength());
44947    }
44948    if (element.hasReasonCode()) {
44949      openArray("reasonCode");
44950      for (CodeableConcept e : element.getReasonCode())
44951        composeCodeableConcept(null, e);
44952      closeArray();
44953    }
44954    ;
44955    if (element.hasReasonReference()) {
44956      openArray("reasonReference");
44957      for (Reference e : element.getReasonReference())
44958        composeReference(null, e);
44959      closeArray();
44960    }
44961    ;
44962    if (element.hasDiagnosis()) {
44963      openArray("diagnosis");
44964      for (Encounter.DiagnosisComponent e : element.getDiagnosis())
44965        composeEncounterDiagnosisComponent(null, e);
44966      closeArray();
44967    }
44968    ;
44969    if (element.hasAccount()) {
44970      openArray("account");
44971      for (Reference e : element.getAccount())
44972        composeReference(null, e);
44973      closeArray();
44974    }
44975    ;
44976    if (element.hasHospitalization()) {
44977      composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
44978    }
44979    if (element.hasLocation()) {
44980      openArray("location");
44981      for (Encounter.EncounterLocationComponent e : element.getLocation())
44982        composeEncounterEncounterLocationComponent(null, e);
44983      closeArray();
44984    }
44985    ;
44986    if (element.hasServiceProvider()) {
44987      composeReference("serviceProvider", element.getServiceProvider());
44988    }
44989    if (element.hasPartOf()) {
44990      composeReference("partOf", element.getPartOf());
44991    }
44992  }
44993
44994  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element)
44995      throws IOException {
44996    if (element != null) {
44997      open(name);
44998      composeEncounterStatusHistoryComponentInner(element);
44999      close();
45000    }
45001  }
45002
45003  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element)
45004      throws IOException {
45005    composeBackbone(element);
45006    if (element.hasStatusElement()) {
45007      composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
45008      composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
45009    }
45010    if (element.hasPeriod()) {
45011      composePeriod("period", element.getPeriod());
45012    }
45013  }
45014
45015  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element)
45016      throws IOException {
45017    if (element != null) {
45018      open(name);
45019      composeEncounterClassHistoryComponentInner(element);
45020      close();
45021    }
45022  }
45023
45024  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element)
45025      throws IOException {
45026    composeBackbone(element);
45027    if (element.hasClass_()) {
45028      composeCoding("class", element.getClass_());
45029    }
45030    if (element.hasPeriod()) {
45031      composePeriod("period", element.getPeriod());
45032    }
45033  }
45034
45035  protected void composeEncounterEncounterParticipantComponent(String name,
45036      Encounter.EncounterParticipantComponent element) throws IOException {
45037    if (element != null) {
45038      open(name);
45039      composeEncounterEncounterParticipantComponentInner(element);
45040      close();
45041    }
45042  }
45043
45044  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element)
45045      throws IOException {
45046    composeBackbone(element);
45047    if (element.hasType()) {
45048      openArray("type");
45049      for (CodeableConcept e : element.getType())
45050        composeCodeableConcept(null, e);
45051      closeArray();
45052    }
45053    ;
45054    if (element.hasPeriod()) {
45055      composePeriod("period", element.getPeriod());
45056    }
45057    if (element.hasIndividual()) {
45058      composeReference("individual", element.getIndividual());
45059    }
45060  }
45061
45062  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element)
45063      throws IOException {
45064    if (element != null) {
45065      open(name);
45066      composeEncounterDiagnosisComponentInner(element);
45067      close();
45068    }
45069  }
45070
45071  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
45072    composeBackbone(element);
45073    if (element.hasCondition()) {
45074      composeReference("condition", element.getCondition());
45075    }
45076    if (element.hasUse()) {
45077      composeCodeableConcept("use", element.getUse());
45078    }
45079    if (element.hasRankElement()) {
45080      composePositiveIntCore("rank", element.getRankElement(), false);
45081      composePositiveIntExtras("rank", element.getRankElement(), false);
45082    }
45083  }
45084
45085  protected void composeEncounterEncounterHospitalizationComponent(String name,
45086      Encounter.EncounterHospitalizationComponent element) throws IOException {
45087    if (element != null) {
45088      open(name);
45089      composeEncounterEncounterHospitalizationComponentInner(element);
45090      close();
45091    }
45092  }
45093
45094  protected void composeEncounterEncounterHospitalizationComponentInner(
45095      Encounter.EncounterHospitalizationComponent element) throws IOException {
45096    composeBackbone(element);
45097    if (element.hasPreAdmissionIdentifier()) {
45098      composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
45099    }
45100    if (element.hasOrigin()) {
45101      composeReference("origin", element.getOrigin());
45102    }
45103    if (element.hasAdmitSource()) {
45104      composeCodeableConcept("admitSource", element.getAdmitSource());
45105    }
45106    if (element.hasReAdmission()) {
45107      composeCodeableConcept("reAdmission", element.getReAdmission());
45108    }
45109    if (element.hasDietPreference()) {
45110      openArray("dietPreference");
45111      for (CodeableConcept e : element.getDietPreference())
45112        composeCodeableConcept(null, e);
45113      closeArray();
45114    }
45115    ;
45116    if (element.hasSpecialCourtesy()) {
45117      openArray("specialCourtesy");
45118      for (CodeableConcept e : element.getSpecialCourtesy())
45119        composeCodeableConcept(null, e);
45120      closeArray();
45121    }
45122    ;
45123    if (element.hasSpecialArrangement()) {
45124      openArray("specialArrangement");
45125      for (CodeableConcept e : element.getSpecialArrangement())
45126        composeCodeableConcept(null, e);
45127      closeArray();
45128    }
45129    ;
45130    if (element.hasDestination()) {
45131      composeReference("destination", element.getDestination());
45132    }
45133    if (element.hasDischargeDisposition()) {
45134      composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
45135    }
45136  }
45137
45138  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element)
45139      throws IOException {
45140    if (element != null) {
45141      open(name);
45142      composeEncounterEncounterLocationComponentInner(element);
45143      close();
45144    }
45145  }
45146
45147  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element)
45148      throws IOException {
45149    composeBackbone(element);
45150    if (element.hasLocation()) {
45151      composeReference("location", element.getLocation());
45152    }
45153    if (element.hasStatusElement()) {
45154      composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(),
45155          false);
45156      composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(),
45157          false);
45158    }
45159    if (element.hasPhysicalType()) {
45160      composeCodeableConcept("physicalType", element.getPhysicalType());
45161    }
45162    if (element.hasPeriod()) {
45163      composePeriod("period", element.getPeriod());
45164    }
45165  }
45166
45167  protected void composeEndpoint(String name, Endpoint element) throws IOException {
45168    if (element != null) {
45169      prop("resourceType", name);
45170      composeEndpointInner(element);
45171    }
45172  }
45173
45174  protected void composeEndpointInner(Endpoint element) throws IOException {
45175    composeDomainResourceElements(element);
45176    if (element.hasIdentifier()) {
45177      openArray("identifier");
45178      for (Identifier e : element.getIdentifier())
45179        composeIdentifier(null, e);
45180      closeArray();
45181    }
45182    ;
45183    if (element.hasStatusElement()) {
45184      composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
45185      composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
45186    }
45187    if (element.hasConnectionType()) {
45188      composeCoding("connectionType", element.getConnectionType());
45189    }
45190    if (element.hasNameElement()) {
45191      composeStringCore("name", element.getNameElement(), false);
45192      composeStringExtras("name", element.getNameElement(), false);
45193    }
45194    if (element.hasManagingOrganization()) {
45195      composeReference("managingOrganization", element.getManagingOrganization());
45196    }
45197    if (element.hasContact()) {
45198      openArray("contact");
45199      for (ContactPoint e : element.getContact())
45200        composeContactPoint(null, e);
45201      closeArray();
45202    }
45203    ;
45204    if (element.hasPeriod()) {
45205      composePeriod("period", element.getPeriod());
45206    }
45207    if (element.hasPayloadType()) {
45208      openArray("payloadType");
45209      for (CodeableConcept e : element.getPayloadType())
45210        composeCodeableConcept(null, e);
45211      closeArray();
45212    }
45213    ;
45214    if (element.hasPayloadMimeType()) {
45215      openArray("payloadMimeType");
45216      for (CodeType e : element.getPayloadMimeType())
45217        composeCodeCore(null, e, true);
45218      closeArray();
45219      if (anyHasExtras(element.getPayloadMimeType())) {
45220        openArray("_payloadMimeType");
45221        for (CodeType e : element.getPayloadMimeType())
45222          composeCodeExtras(null, e, true);
45223        closeArray();
45224      }
45225    }
45226    ;
45227    if (element.hasAddressElement()) {
45228      composeUrlCore("address", element.getAddressElement(), false);
45229      composeUrlExtras("address", element.getAddressElement(), false);
45230    }
45231    if (element.hasHeader()) {
45232      openArray("header");
45233      for (StringType e : element.getHeader())
45234        composeStringCore(null, e, true);
45235      closeArray();
45236      if (anyHasExtras(element.getHeader())) {
45237        openArray("_header");
45238        for (StringType e : element.getHeader())
45239          composeStringExtras(null, e, true);
45240        closeArray();
45241      }
45242    }
45243    ;
45244  }
45245
45246  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
45247    if (element != null) {
45248      prop("resourceType", name);
45249      composeEnrollmentRequestInner(element);
45250    }
45251  }
45252
45253  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
45254    composeDomainResourceElements(element);
45255    if (element.hasIdentifier()) {
45256      openArray("identifier");
45257      for (Identifier e : element.getIdentifier())
45258        composeIdentifier(null, e);
45259      closeArray();
45260    }
45261    ;
45262    if (element.hasStatusElement()) {
45263      composeEnumerationCore("status", element.getStatusElement(),
45264          new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
45265      composeEnumerationExtras("status", element.getStatusElement(),
45266          new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
45267    }
45268    if (element.hasCreatedElement()) {
45269      composeDateTimeCore("created", element.getCreatedElement(), false);
45270      composeDateTimeExtras("created", element.getCreatedElement(), false);
45271    }
45272    if (element.hasInsurer()) {
45273      composeReference("insurer", element.getInsurer());
45274    }
45275    if (element.hasProvider()) {
45276      composeReference("provider", element.getProvider());
45277    }
45278    if (element.hasCandidate()) {
45279      composeReference("candidate", element.getCandidate());
45280    }
45281    if (element.hasCoverage()) {
45282      composeReference("coverage", element.getCoverage());
45283    }
45284  }
45285
45286  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
45287    if (element != null) {
45288      prop("resourceType", name);
45289      composeEnrollmentResponseInner(element);
45290    }
45291  }
45292
45293  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
45294    composeDomainResourceElements(element);
45295    if (element.hasIdentifier()) {
45296      openArray("identifier");
45297      for (Identifier e : element.getIdentifier())
45298        composeIdentifier(null, e);
45299      closeArray();
45300    }
45301    ;
45302    if (element.hasStatusElement()) {
45303      composeEnumerationCore("status", element.getStatusElement(),
45304          new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
45305      composeEnumerationExtras("status", element.getStatusElement(),
45306          new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
45307    }
45308    if (element.hasRequest()) {
45309      composeReference("request", element.getRequest());
45310    }
45311    if (element.hasOutcomeElement()) {
45312      composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(),
45313          false);
45314      composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(),
45315          false);
45316    }
45317    if (element.hasDispositionElement()) {
45318      composeStringCore("disposition", element.getDispositionElement(), false);
45319      composeStringExtras("disposition", element.getDispositionElement(), false);
45320    }
45321    if (element.hasCreatedElement()) {
45322      composeDateTimeCore("created", element.getCreatedElement(), false);
45323      composeDateTimeExtras("created", element.getCreatedElement(), false);
45324    }
45325    if (element.hasOrganization()) {
45326      composeReference("organization", element.getOrganization());
45327    }
45328    if (element.hasRequestProvider()) {
45329      composeReference("requestProvider", element.getRequestProvider());
45330    }
45331  }
45332
45333  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
45334    if (element != null) {
45335      prop("resourceType", name);
45336      composeEpisodeOfCareInner(element);
45337    }
45338  }
45339
45340  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
45341    composeDomainResourceElements(element);
45342    if (element.hasIdentifier()) {
45343      openArray("identifier");
45344      for (Identifier e : element.getIdentifier())
45345        composeIdentifier(null, e);
45346      closeArray();
45347    }
45348    ;
45349    if (element.hasStatusElement()) {
45350      composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(),
45351          false);
45352      composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(),
45353          false);
45354    }
45355    if (element.hasStatusHistory()) {
45356      openArray("statusHistory");
45357      for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory())
45358        composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
45359      closeArray();
45360    }
45361    ;
45362    if (element.hasType()) {
45363      openArray("type");
45364      for (CodeableConcept e : element.getType())
45365        composeCodeableConcept(null, e);
45366      closeArray();
45367    }
45368    ;
45369    if (element.hasDiagnosis()) {
45370      openArray("diagnosis");
45371      for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis())
45372        composeEpisodeOfCareDiagnosisComponent(null, e);
45373      closeArray();
45374    }
45375    ;
45376    if (element.hasPatient()) {
45377      composeReference("patient", element.getPatient());
45378    }
45379    if (element.hasManagingOrganization()) {
45380      composeReference("managingOrganization", element.getManagingOrganization());
45381    }
45382    if (element.hasPeriod()) {
45383      composePeriod("period", element.getPeriod());
45384    }
45385    if (element.hasReferralRequest()) {
45386      openArray("referralRequest");
45387      for (Reference e : element.getReferralRequest())
45388        composeReference(null, e);
45389      closeArray();
45390    }
45391    ;
45392    if (element.hasCareManager()) {
45393      composeReference("careManager", element.getCareManager());
45394    }
45395    if (element.hasTeam()) {
45396      openArray("team");
45397      for (Reference e : element.getTeam())
45398        composeReference(null, e);
45399      closeArray();
45400    }
45401    ;
45402    if (element.hasAccount()) {
45403      openArray("account");
45404      for (Reference e : element.getAccount())
45405        composeReference(null, e);
45406      closeArray();
45407    }
45408    ;
45409  }
45410
45411  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name,
45412      EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
45413    if (element != null) {
45414      open(name);
45415      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
45416      close();
45417    }
45418  }
45419
45420  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(
45421      EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
45422    composeBackbone(element);
45423    if (element.hasStatusElement()) {
45424      composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(),
45425          false);
45426      composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(),
45427          false);
45428    }
45429    if (element.hasPeriod()) {
45430      composePeriod("period", element.getPeriod());
45431    }
45432  }
45433
45434  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element)
45435      throws IOException {
45436    if (element != null) {
45437      open(name);
45438      composeEpisodeOfCareDiagnosisComponentInner(element);
45439      close();
45440    }
45441  }
45442
45443  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element)
45444      throws IOException {
45445    composeBackbone(element);
45446    if (element.hasCondition()) {
45447      composeReference("condition", element.getCondition());
45448    }
45449    if (element.hasRole()) {
45450      composeCodeableConcept("role", element.getRole());
45451    }
45452    if (element.hasRankElement()) {
45453      composePositiveIntCore("rank", element.getRankElement(), false);
45454      composePositiveIntExtras("rank", element.getRankElement(), false);
45455    }
45456  }
45457
45458  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
45459    if (element != null) {
45460      prop("resourceType", name);
45461      composeEventDefinitionInner(element);
45462    }
45463  }
45464
45465  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
45466    composeDomainResourceElements(element);
45467    if (element.hasUrlElement()) {
45468      composeUriCore("url", element.getUrlElement(), false);
45469      composeUriExtras("url", element.getUrlElement(), false);
45470    }
45471    if (element.hasIdentifier()) {
45472      openArray("identifier");
45473      for (Identifier e : element.getIdentifier())
45474        composeIdentifier(null, e);
45475      closeArray();
45476    }
45477    ;
45478    if (element.hasVersionElement()) {
45479      composeStringCore("version", element.getVersionElement(), false);
45480      composeStringExtras("version", element.getVersionElement(), false);
45481    }
45482    if (element.hasNameElement()) {
45483      composeStringCore("name", element.getNameElement(), false);
45484      composeStringExtras("name", element.getNameElement(), false);
45485    }
45486    if (element.hasTitleElement()) {
45487      composeStringCore("title", element.getTitleElement(), false);
45488      composeStringExtras("title", element.getTitleElement(), false);
45489    }
45490    if (element.hasSubtitleElement()) {
45491      composeStringCore("subtitle", element.getSubtitleElement(), false);
45492      composeStringExtras("subtitle", element.getSubtitleElement(), false);
45493    }
45494    if (element.hasStatusElement()) {
45495      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
45496          false);
45497      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
45498          false);
45499    }
45500    if (element.hasExperimentalElement()) {
45501      composeBooleanCore("experimental", element.getExperimentalElement(), false);
45502      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45503    }
45504    if (element.hasSubject()) {
45505      composeType("subject", element.getSubject());
45506    }
45507    if (element.hasDateElement()) {
45508      composeDateTimeCore("date", element.getDateElement(), false);
45509      composeDateTimeExtras("date", element.getDateElement(), false);
45510    }
45511    if (element.hasPublisherElement()) {
45512      composeStringCore("publisher", element.getPublisherElement(), false);
45513      composeStringExtras("publisher", element.getPublisherElement(), false);
45514    }
45515    if (element.hasContact()) {
45516      openArray("contact");
45517      for (ContactDetail e : element.getContact())
45518        composeContactDetail(null, e);
45519      closeArray();
45520    }
45521    ;
45522    if (element.hasDescriptionElement()) {
45523      composeMarkdownCore("description", element.getDescriptionElement(), false);
45524      composeMarkdownExtras("description", element.getDescriptionElement(), false);
45525    }
45526    if (element.hasUseContext()) {
45527      openArray("useContext");
45528      for (UsageContext e : element.getUseContext())
45529        composeUsageContext(null, e);
45530      closeArray();
45531    }
45532    ;
45533    if (element.hasJurisdiction()) {
45534      openArray("jurisdiction");
45535      for (CodeableConcept e : element.getJurisdiction())
45536        composeCodeableConcept(null, e);
45537      closeArray();
45538    }
45539    ;
45540    if (element.hasPurposeElement()) {
45541      composeMarkdownCore("purpose", element.getPurposeElement(), false);
45542      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45543    }
45544    if (element.hasUsageElement()) {
45545      composeStringCore("usage", element.getUsageElement(), false);
45546      composeStringExtras("usage", element.getUsageElement(), false);
45547    }
45548    if (element.hasCopyrightElement()) {
45549      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45550      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45551    }
45552    if (element.hasApprovalDateElement()) {
45553      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45554      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45555    }
45556    if (element.hasLastReviewDateElement()) {
45557      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45558      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45559    }
45560    if (element.hasEffectivePeriod()) {
45561      composePeriod("effectivePeriod", element.getEffectivePeriod());
45562    }
45563    if (element.hasTopic()) {
45564      openArray("topic");
45565      for (CodeableConcept e : element.getTopic())
45566        composeCodeableConcept(null, e);
45567      closeArray();
45568    }
45569    ;
45570    if (element.hasAuthor()) {
45571      openArray("author");
45572      for (ContactDetail e : element.getAuthor())
45573        composeContactDetail(null, e);
45574      closeArray();
45575    }
45576    ;
45577    if (element.hasEditor()) {
45578      openArray("editor");
45579      for (ContactDetail e : element.getEditor())
45580        composeContactDetail(null, e);
45581      closeArray();
45582    }
45583    ;
45584    if (element.hasReviewer()) {
45585      openArray("reviewer");
45586      for (ContactDetail e : element.getReviewer())
45587        composeContactDetail(null, e);
45588      closeArray();
45589    }
45590    ;
45591    if (element.hasEndorser()) {
45592      openArray("endorser");
45593      for (ContactDetail e : element.getEndorser())
45594        composeContactDetail(null, e);
45595      closeArray();
45596    }
45597    ;
45598    if (element.hasRelatedArtifact()) {
45599      openArray("relatedArtifact");
45600      for (RelatedArtifact e : element.getRelatedArtifact())
45601        composeRelatedArtifact(null, e);
45602      closeArray();
45603    }
45604    ;
45605    if (element.hasTrigger()) {
45606      openArray("trigger");
45607      for (TriggerDefinition e : element.getTrigger())
45608        composeTriggerDefinition(null, e);
45609      closeArray();
45610    }
45611    ;
45612  }
45613
45614  protected void composeEvidence(String name, Evidence element) throws IOException {
45615    if (element != null) {
45616      prop("resourceType", name);
45617      composeEvidenceInner(element);
45618    }
45619  }
45620
45621  protected void composeEvidenceInner(Evidence element) throws IOException {
45622    composeDomainResourceElements(element);
45623    if (element.hasUrlElement()) {
45624      composeUriCore("url", element.getUrlElement(), false);
45625      composeUriExtras("url", element.getUrlElement(), false);
45626    }
45627    if (element.hasIdentifier()) {
45628      openArray("identifier");
45629      for (Identifier e : element.getIdentifier())
45630        composeIdentifier(null, e);
45631      closeArray();
45632    }
45633    ;
45634    if (element.hasVersionElement()) {
45635      composeStringCore("version", element.getVersionElement(), false);
45636      composeStringExtras("version", element.getVersionElement(), false);
45637    }
45638    if (element.hasNameElement()) {
45639      composeStringCore("name", element.getNameElement(), false);
45640      composeStringExtras("name", element.getNameElement(), false);
45641    }
45642    if (element.hasTitleElement()) {
45643      composeStringCore("title", element.getTitleElement(), false);
45644      composeStringExtras("title", element.getTitleElement(), false);
45645    }
45646    if (element.hasShortTitleElement()) {
45647      composeStringCore("shortTitle", element.getShortTitleElement(), false);
45648      composeStringExtras("shortTitle", element.getShortTitleElement(), false);
45649    }
45650    if (element.hasSubtitleElement()) {
45651      composeStringCore("subtitle", element.getSubtitleElement(), false);
45652      composeStringExtras("subtitle", element.getSubtitleElement(), false);
45653    }
45654    if (element.hasStatusElement()) {
45655      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
45656          false);
45657      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
45658          false);
45659    }
45660    if (element.hasDateElement()) {
45661      composeDateTimeCore("date", element.getDateElement(), false);
45662      composeDateTimeExtras("date", element.getDateElement(), false);
45663    }
45664    if (element.hasPublisherElement()) {
45665      composeStringCore("publisher", element.getPublisherElement(), false);
45666      composeStringExtras("publisher", element.getPublisherElement(), false);
45667    }
45668    if (element.hasContact()) {
45669      openArray("contact");
45670      for (ContactDetail e : element.getContact())
45671        composeContactDetail(null, e);
45672      closeArray();
45673    }
45674    ;
45675    if (element.hasDescriptionElement()) {
45676      composeMarkdownCore("description", element.getDescriptionElement(), false);
45677      composeMarkdownExtras("description", element.getDescriptionElement(), false);
45678    }
45679    if (element.hasNote()) {
45680      openArray("note");
45681      for (Annotation e : element.getNote())
45682        composeAnnotation(null, e);
45683      closeArray();
45684    }
45685    ;
45686    if (element.hasUseContext()) {
45687      openArray("useContext");
45688      for (UsageContext e : element.getUseContext())
45689        composeUsageContext(null, e);
45690      closeArray();
45691    }
45692    ;
45693    if (element.hasJurisdiction()) {
45694      openArray("jurisdiction");
45695      for (CodeableConcept e : element.getJurisdiction())
45696        composeCodeableConcept(null, e);
45697      closeArray();
45698    }
45699    ;
45700    if (element.hasCopyrightElement()) {
45701      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45702      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45703    }
45704    if (element.hasApprovalDateElement()) {
45705      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45706      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45707    }
45708    if (element.hasLastReviewDateElement()) {
45709      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45710      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45711    }
45712    if (element.hasEffectivePeriod()) {
45713      composePeriod("effectivePeriod", element.getEffectivePeriod());
45714    }
45715    if (element.hasTopic()) {
45716      openArray("topic");
45717      for (CodeableConcept e : element.getTopic())
45718        composeCodeableConcept(null, e);
45719      closeArray();
45720    }
45721    ;
45722    if (element.hasAuthor()) {
45723      openArray("author");
45724      for (ContactDetail e : element.getAuthor())
45725        composeContactDetail(null, e);
45726      closeArray();
45727    }
45728    ;
45729    if (element.hasEditor()) {
45730      openArray("editor");
45731      for (ContactDetail e : element.getEditor())
45732        composeContactDetail(null, e);
45733      closeArray();
45734    }
45735    ;
45736    if (element.hasReviewer()) {
45737      openArray("reviewer");
45738      for (ContactDetail e : element.getReviewer())
45739        composeContactDetail(null, e);
45740      closeArray();
45741    }
45742    ;
45743    if (element.hasEndorser()) {
45744      openArray("endorser");
45745      for (ContactDetail e : element.getEndorser())
45746        composeContactDetail(null, e);
45747      closeArray();
45748    }
45749    ;
45750    if (element.hasRelatedArtifact()) {
45751      openArray("relatedArtifact");
45752      for (RelatedArtifact e : element.getRelatedArtifact())
45753        composeRelatedArtifact(null, e);
45754      closeArray();
45755    }
45756    ;
45757    if (element.hasExposureBackground()) {
45758      composeReference("exposureBackground", element.getExposureBackground());
45759    }
45760    if (element.hasExposureVariant()) {
45761      openArray("exposureVariant");
45762      for (Reference e : element.getExposureVariant())
45763        composeReference(null, e);
45764      closeArray();
45765    }
45766    ;
45767    if (element.hasOutcome()) {
45768      openArray("outcome");
45769      for (Reference e : element.getOutcome())
45770        composeReference(null, e);
45771      closeArray();
45772    }
45773    ;
45774  }
45775
45776  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
45777    if (element != null) {
45778      prop("resourceType", name);
45779      composeEvidenceVariableInner(element);
45780    }
45781  }
45782
45783  protected void composeEvidenceVariableInner(EvidenceVariable element) throws IOException {
45784    composeDomainResourceElements(element);
45785    if (element.hasUrlElement()) {
45786      composeUriCore("url", element.getUrlElement(), false);
45787      composeUriExtras("url", element.getUrlElement(), false);
45788    }
45789    if (element.hasIdentifier()) {
45790      openArray("identifier");
45791      for (Identifier e : element.getIdentifier())
45792        composeIdentifier(null, e);
45793      closeArray();
45794    }
45795    ;
45796    if (element.hasVersionElement()) {
45797      composeStringCore("version", element.getVersionElement(), false);
45798      composeStringExtras("version", element.getVersionElement(), false);
45799    }
45800    if (element.hasNameElement()) {
45801      composeStringCore("name", element.getNameElement(), false);
45802      composeStringExtras("name", element.getNameElement(), false);
45803    }
45804    if (element.hasTitleElement()) {
45805      composeStringCore("title", element.getTitleElement(), false);
45806      composeStringExtras("title", element.getTitleElement(), false);
45807    }
45808    if (element.hasShortTitleElement()) {
45809      composeStringCore("shortTitle", element.getShortTitleElement(), false);
45810      composeStringExtras("shortTitle", element.getShortTitleElement(), false);
45811    }
45812    if (element.hasSubtitleElement()) {
45813      composeStringCore("subtitle", element.getSubtitleElement(), false);
45814      composeStringExtras("subtitle", element.getSubtitleElement(), false);
45815    }
45816    if (element.hasStatusElement()) {
45817      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
45818          false);
45819      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
45820          false);
45821    }
45822    if (element.hasDateElement()) {
45823      composeDateTimeCore("date", element.getDateElement(), false);
45824      composeDateTimeExtras("date", element.getDateElement(), false);
45825    }
45826    if (element.hasPublisherElement()) {
45827      composeStringCore("publisher", element.getPublisherElement(), false);
45828      composeStringExtras("publisher", element.getPublisherElement(), false);
45829    }
45830    if (element.hasContact()) {
45831      openArray("contact");
45832      for (ContactDetail e : element.getContact())
45833        composeContactDetail(null, e);
45834      closeArray();
45835    }
45836    ;
45837    if (element.hasDescriptionElement()) {
45838      composeMarkdownCore("description", element.getDescriptionElement(), false);
45839      composeMarkdownExtras("description", element.getDescriptionElement(), false);
45840    }
45841    if (element.hasNote()) {
45842      openArray("note");
45843      for (Annotation e : element.getNote())
45844        composeAnnotation(null, e);
45845      closeArray();
45846    }
45847    ;
45848    if (element.hasUseContext()) {
45849      openArray("useContext");
45850      for (UsageContext e : element.getUseContext())
45851        composeUsageContext(null, e);
45852      closeArray();
45853    }
45854    ;
45855    if (element.hasJurisdiction()) {
45856      openArray("jurisdiction");
45857      for (CodeableConcept e : element.getJurisdiction())
45858        composeCodeableConcept(null, e);
45859      closeArray();
45860    }
45861    ;
45862    if (element.hasCopyrightElement()) {
45863      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45864      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45865    }
45866    if (element.hasApprovalDateElement()) {
45867      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45868      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45869    }
45870    if (element.hasLastReviewDateElement()) {
45871      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45872      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45873    }
45874    if (element.hasEffectivePeriod()) {
45875      composePeriod("effectivePeriod", element.getEffectivePeriod());
45876    }
45877    if (element.hasTopic()) {
45878      openArray("topic");
45879      for (CodeableConcept e : element.getTopic())
45880        composeCodeableConcept(null, e);
45881      closeArray();
45882    }
45883    ;
45884    if (element.hasAuthor()) {
45885      openArray("author");
45886      for (ContactDetail e : element.getAuthor())
45887        composeContactDetail(null, e);
45888      closeArray();
45889    }
45890    ;
45891    if (element.hasEditor()) {
45892      openArray("editor");
45893      for (ContactDetail e : element.getEditor())
45894        composeContactDetail(null, e);
45895      closeArray();
45896    }
45897    ;
45898    if (element.hasReviewer()) {
45899      openArray("reviewer");
45900      for (ContactDetail e : element.getReviewer())
45901        composeContactDetail(null, e);
45902      closeArray();
45903    }
45904    ;
45905    if (element.hasEndorser()) {
45906      openArray("endorser");
45907      for (ContactDetail e : element.getEndorser())
45908        composeContactDetail(null, e);
45909      closeArray();
45910    }
45911    ;
45912    if (element.hasRelatedArtifact()) {
45913      openArray("relatedArtifact");
45914      for (RelatedArtifact e : element.getRelatedArtifact())
45915        composeRelatedArtifact(null, e);
45916      closeArray();
45917    }
45918    ;
45919    if (element.hasTypeElement()) {
45920      composeEnumerationCore("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(),
45921          false);
45922      composeEnumerationExtras("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(),
45923          false);
45924    }
45925    if (element.hasCharacteristic()) {
45926      openArray("characteristic");
45927      for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic())
45928        composeEvidenceVariableEvidenceVariableCharacteristicComponent(null, e);
45929      closeArray();
45930    }
45931    ;
45932  }
45933
45934  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponent(String name,
45935      EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
45936    if (element != null) {
45937      open(name);
45938      composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(element);
45939      close();
45940    }
45941  }
45942
45943  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(
45944      EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
45945    composeBackbone(element);
45946    if (element.hasDescriptionElement()) {
45947      composeStringCore("description", element.getDescriptionElement(), false);
45948      composeStringExtras("description", element.getDescriptionElement(), false);
45949    }
45950    if (element.hasDefinition()) {
45951      composeType("definition", element.getDefinition());
45952    }
45953    if (element.hasUsageContext()) {
45954      openArray("usageContext");
45955      for (UsageContext e : element.getUsageContext())
45956        composeUsageContext(null, e);
45957      closeArray();
45958    }
45959    ;
45960    if (element.hasExcludeElement()) {
45961      composeBooleanCore("exclude", element.getExcludeElement(), false);
45962      composeBooleanExtras("exclude", element.getExcludeElement(), false);
45963    }
45964    if (element.hasParticipantEffective()) {
45965      composeType("participantEffective", element.getParticipantEffective());
45966    }
45967    if (element.hasTimeFromStart()) {
45968      composeDuration("timeFromStart", element.getTimeFromStart());
45969    }
45970    if (element.hasGroupMeasureElement()) {
45971      composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(),
45972          new EvidenceVariable.GroupMeasureEnumFactory(), false);
45973      composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(),
45974          new EvidenceVariable.GroupMeasureEnumFactory(), false);
45975    }
45976  }
45977
45978  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
45979    if (element != null) {
45980      prop("resourceType", name);
45981      composeExampleScenarioInner(element);
45982    }
45983  }
45984
45985  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
45986    composeDomainResourceElements(element);
45987    if (element.hasUrlElement()) {
45988      composeUriCore("url", element.getUrlElement(), false);
45989      composeUriExtras("url", element.getUrlElement(), false);
45990    }
45991    if (element.hasIdentifier()) {
45992      openArray("identifier");
45993      for (Identifier e : element.getIdentifier())
45994        composeIdentifier(null, e);
45995      closeArray();
45996    }
45997    ;
45998    if (element.hasVersionElement()) {
45999      composeStringCore("version", element.getVersionElement(), false);
46000      composeStringExtras("version", element.getVersionElement(), false);
46001    }
46002    if (element.hasNameElement()) {
46003      composeStringCore("name", element.getNameElement(), false);
46004      composeStringExtras("name", element.getNameElement(), false);
46005    }
46006    if (element.hasStatusElement()) {
46007      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
46008          false);
46009      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
46010          false);
46011    }
46012    if (element.hasExperimentalElement()) {
46013      composeBooleanCore("experimental", element.getExperimentalElement(), false);
46014      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46015    }
46016    if (element.hasDateElement()) {
46017      composeDateTimeCore("date", element.getDateElement(), false);
46018      composeDateTimeExtras("date", element.getDateElement(), false);
46019    }
46020    if (element.hasPublisherElement()) {
46021      composeStringCore("publisher", element.getPublisherElement(), false);
46022      composeStringExtras("publisher", element.getPublisherElement(), false);
46023    }
46024    if (element.hasContact()) {
46025      openArray("contact");
46026      for (ContactDetail e : element.getContact())
46027        composeContactDetail(null, e);
46028      closeArray();
46029    }
46030    ;
46031    if (element.hasUseContext()) {
46032      openArray("useContext");
46033      for (UsageContext e : element.getUseContext())
46034        composeUsageContext(null, e);
46035      closeArray();
46036    }
46037    ;
46038    if (element.hasJurisdiction()) {
46039      openArray("jurisdiction");
46040      for (CodeableConcept e : element.getJurisdiction())
46041        composeCodeableConcept(null, e);
46042      closeArray();
46043    }
46044    ;
46045    if (element.hasCopyrightElement()) {
46046      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46047      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46048    }
46049    if (element.hasPurposeElement()) {
46050      composeMarkdownCore("purpose", element.getPurposeElement(), false);
46051      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46052    }
46053    if (element.hasActor()) {
46054      openArray("actor");
46055      for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor())
46056        composeExampleScenarioExampleScenarioActorComponent(null, e);
46057      closeArray();
46058    }
46059    ;
46060    if (element.hasInstance()) {
46061      openArray("instance");
46062      for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance())
46063        composeExampleScenarioExampleScenarioInstanceComponent(null, e);
46064      closeArray();
46065    }
46066    ;
46067    if (element.hasProcess()) {
46068      openArray("process");
46069      for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess())
46070        composeExampleScenarioExampleScenarioProcessComponent(null, e);
46071      closeArray();
46072    }
46073    ;
46074    if (element.hasWorkflow()) {
46075      openArray("workflow");
46076      for (CanonicalType e : element.getWorkflow())
46077        composeCanonicalCore(null, e, true);
46078      closeArray();
46079      if (anyHasExtras(element.getWorkflow())) {
46080        openArray("_workflow");
46081        for (CanonicalType e : element.getWorkflow())
46082          composeCanonicalExtras(null, e, true);
46083        closeArray();
46084      }
46085    }
46086    ;
46087  }
46088
46089  protected void composeExampleScenarioExampleScenarioActorComponent(String name,
46090      ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
46091    if (element != null) {
46092      open(name);
46093      composeExampleScenarioExampleScenarioActorComponentInner(element);
46094      close();
46095    }
46096  }
46097
46098  protected void composeExampleScenarioExampleScenarioActorComponentInner(
46099      ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
46100    composeBackbone(element);
46101    if (element.hasActorIdElement()) {
46102      composeStringCore("actorId", element.getActorIdElement(), false);
46103      composeStringExtras("actorId", element.getActorIdElement(), false);
46104    }
46105    if (element.hasTypeElement()) {
46106      composeEnumerationCore("type", element.getTypeElement(),
46107          new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
46108      composeEnumerationExtras("type", element.getTypeElement(),
46109          new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
46110    }
46111    if (element.hasNameElement()) {
46112      composeStringCore("name", element.getNameElement(), false);
46113      composeStringExtras("name", element.getNameElement(), false);
46114    }
46115    if (element.hasDescriptionElement()) {
46116      composeMarkdownCore("description", element.getDescriptionElement(), false);
46117      composeMarkdownExtras("description", element.getDescriptionElement(), false);
46118    }
46119  }
46120
46121  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name,
46122      ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
46123    if (element != null) {
46124      open(name);
46125      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
46126      close();
46127    }
46128  }
46129
46130  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(
46131      ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
46132    composeBackbone(element);
46133    if (element.hasResourceIdElement()) {
46134      composeStringCore("resourceId", element.getResourceIdElement(), false);
46135      composeStringExtras("resourceId", element.getResourceIdElement(), false);
46136    }
46137    if (element.hasResourceTypeElement()) {
46138      composeEnumerationCore("resourceType", element.getResourceTypeElement(),
46139          new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
46140      composeEnumerationExtras("resourceType", element.getResourceTypeElement(),
46141          new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
46142    }
46143    if (element.hasNameElement()) {
46144      composeStringCore("name", element.getNameElement(), false);
46145      composeStringExtras("name", element.getNameElement(), false);
46146    }
46147    if (element.hasDescriptionElement()) {
46148      composeMarkdownCore("description", element.getDescriptionElement(), false);
46149      composeMarkdownExtras("description", element.getDescriptionElement(), false);
46150    }
46151    if (element.hasVersion()) {
46152      openArray("version");
46153      for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion())
46154        composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
46155      closeArray();
46156    }
46157    ;
46158    if (element.hasContainedInstance()) {
46159      openArray("containedInstance");
46160      for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance())
46161        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
46162      closeArray();
46163    }
46164    ;
46165  }
46166
46167  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name,
46168      ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
46169    if (element != null) {
46170      open(name);
46171      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
46172      close();
46173    }
46174  }
46175
46176  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(
46177      ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
46178    composeBackbone(element);
46179    if (element.hasVersionIdElement()) {
46180      composeStringCore("versionId", element.getVersionIdElement(), false);
46181      composeStringExtras("versionId", element.getVersionIdElement(), false);
46182    }
46183    if (element.hasDescriptionElement()) {
46184      composeMarkdownCore("description", element.getDescriptionElement(), false);
46185      composeMarkdownExtras("description", element.getDescriptionElement(), false);
46186    }
46187  }
46188
46189  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name,
46190      ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
46191    if (element != null) {
46192      open(name);
46193      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
46194      close();
46195    }
46196  }
46197
46198  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(
46199      ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
46200    composeBackbone(element);
46201    if (element.hasResourceIdElement()) {
46202      composeStringCore("resourceId", element.getResourceIdElement(), false);
46203      composeStringExtras("resourceId", element.getResourceIdElement(), false);
46204    }
46205    if (element.hasVersionIdElement()) {
46206      composeStringCore("versionId", element.getVersionIdElement(), false);
46207      composeStringExtras("versionId", element.getVersionIdElement(), false);
46208    }
46209  }
46210
46211  protected void composeExampleScenarioExampleScenarioProcessComponent(String name,
46212      ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
46213    if (element != null) {
46214      open(name);
46215      composeExampleScenarioExampleScenarioProcessComponentInner(element);
46216      close();
46217    }
46218  }
46219
46220  protected void composeExampleScenarioExampleScenarioProcessComponentInner(
46221      ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
46222    composeBackbone(element);
46223    if (element.hasTitleElement()) {
46224      composeStringCore("title", element.getTitleElement(), false);
46225      composeStringExtras("title", element.getTitleElement(), false);
46226    }
46227    if (element.hasDescriptionElement()) {
46228      composeMarkdownCore("description", element.getDescriptionElement(), false);
46229      composeMarkdownExtras("description", element.getDescriptionElement(), false);
46230    }
46231    if (element.hasPreConditionsElement()) {
46232      composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
46233      composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
46234    }
46235    if (element.hasPostConditionsElement()) {
46236      composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
46237      composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
46238    }
46239    if (element.hasStep()) {
46240      openArray("step");
46241      for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep())
46242        composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
46243      closeArray();
46244    }
46245    ;
46246  }
46247
46248  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name,
46249      ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
46250    if (element != null) {
46251      open(name);
46252      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
46253      close();
46254    }
46255  }
46256
46257  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(
46258      ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
46259    composeBackbone(element);
46260    if (element.hasProcess()) {
46261      openArray("process");
46262      for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess())
46263        composeExampleScenarioExampleScenarioProcessComponent(null, e);
46264      closeArray();
46265    }
46266    ;
46267    if (element.hasPauseElement()) {
46268      composeBooleanCore("pause", element.getPauseElement(), false);
46269      composeBooleanExtras("pause", element.getPauseElement(), false);
46270    }
46271    if (element.hasOperation()) {
46272      composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
46273    }
46274    if (element.hasAlternative()) {
46275      openArray("alternative");
46276      for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative())
46277        composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(null, e);
46278      closeArray();
46279    }
46280    ;
46281  }
46282
46283  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name,
46284      ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
46285    if (element != null) {
46286      open(name);
46287      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
46288      close();
46289    }
46290  }
46291
46292  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(
46293      ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
46294    composeBackbone(element);
46295    if (element.hasNumberElement()) {
46296      composeStringCore("number", element.getNumberElement(), false);
46297      composeStringExtras("number", element.getNumberElement(), false);
46298    }
46299    if (element.hasTypeElement()) {
46300      composeStringCore("type", element.getTypeElement(), false);
46301      composeStringExtras("type", element.getTypeElement(), false);
46302    }
46303    if (element.hasNameElement()) {
46304      composeStringCore("name", element.getNameElement(), false);
46305      composeStringExtras("name", element.getNameElement(), false);
46306    }
46307    if (element.hasInitiatorElement()) {
46308      composeStringCore("initiator", element.getInitiatorElement(), false);
46309      composeStringExtras("initiator", element.getInitiatorElement(), false);
46310    }
46311    if (element.hasReceiverElement()) {
46312      composeStringCore("receiver", element.getReceiverElement(), false);
46313      composeStringExtras("receiver", element.getReceiverElement(), false);
46314    }
46315    if (element.hasDescriptionElement()) {
46316      composeMarkdownCore("description", element.getDescriptionElement(), false);
46317      composeMarkdownExtras("description", element.getDescriptionElement(), false);
46318    }
46319    if (element.hasInitiatorActiveElement()) {
46320      composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
46321      composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
46322    }
46323    if (element.hasReceiverActiveElement()) {
46324      composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
46325      composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
46326    }
46327    if (element.hasRequest()) {
46328      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
46329    }
46330    if (element.hasResponse()) {
46331      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
46332    }
46333  }
46334
46335  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name,
46336      ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
46337    if (element != null) {
46338      open(name);
46339      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
46340      close();
46341    }
46342  }
46343
46344  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(
46345      ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
46346    composeBackbone(element);
46347    if (element.hasTitleElement()) {
46348      composeStringCore("title", element.getTitleElement(), false);
46349      composeStringExtras("title", element.getTitleElement(), false);
46350    }
46351    if (element.hasDescriptionElement()) {
46352      composeMarkdownCore("description", element.getDescriptionElement(), false);
46353      composeMarkdownExtras("description", element.getDescriptionElement(), false);
46354    }
46355    if (element.hasStep()) {
46356      openArray("step");
46357      for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep())
46358        composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
46359      closeArray();
46360    }
46361    ;
46362  }
46363
46364  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
46365    if (element != null) {
46366      prop("resourceType", name);
46367      composeExplanationOfBenefitInner(element);
46368    }
46369  }
46370
46371  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
46372    composeDomainResourceElements(element);
46373    if (element.hasIdentifier()) {
46374      openArray("identifier");
46375      for (Identifier e : element.getIdentifier())
46376        composeIdentifier(null, e);
46377      closeArray();
46378    }
46379    ;
46380    if (element.hasStatusElement()) {
46381      composeEnumerationCore("status", element.getStatusElement(),
46382          new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
46383      composeEnumerationExtras("status", element.getStatusElement(),
46384          new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
46385    }
46386    if (element.hasType()) {
46387      composeCodeableConcept("type", element.getType());
46388    }
46389    if (element.hasSubType()) {
46390      composeCodeableConcept("subType", element.getSubType());
46391    }
46392    if (element.hasUseElement()) {
46393      composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
46394      composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
46395    }
46396    if (element.hasPatient()) {
46397      composeReference("patient", element.getPatient());
46398    }
46399    if (element.hasBillablePeriod()) {
46400      composePeriod("billablePeriod", element.getBillablePeriod());
46401    }
46402    if (element.hasCreatedElement()) {
46403      composeDateTimeCore("created", element.getCreatedElement(), false);
46404      composeDateTimeExtras("created", element.getCreatedElement(), false);
46405    }
46406    if (element.hasEnterer()) {
46407      composeReference("enterer", element.getEnterer());
46408    }
46409    if (element.hasInsurer()) {
46410      composeReference("insurer", element.getInsurer());
46411    }
46412    if (element.hasProvider()) {
46413      composeReference("provider", element.getProvider());
46414    }
46415    if (element.hasPriority()) {
46416      composeCodeableConcept("priority", element.getPriority());
46417    }
46418    if (element.hasFundsReserveRequested()) {
46419      composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
46420    }
46421    if (element.hasFundsReserve()) {
46422      composeCodeableConcept("fundsReserve", element.getFundsReserve());
46423    }
46424    if (element.hasRelated()) {
46425      openArray("related");
46426      for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated())
46427        composeExplanationOfBenefitRelatedClaimComponent(null, e);
46428      closeArray();
46429    }
46430    ;
46431    if (element.hasPrescription()) {
46432      composeReference("prescription", element.getPrescription());
46433    }
46434    if (element.hasOriginalPrescription()) {
46435      composeReference("originalPrescription", element.getOriginalPrescription());
46436    }
46437    if (element.hasPayee()) {
46438      composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
46439    }
46440    if (element.hasReferral()) {
46441      composeReference("referral", element.getReferral());
46442    }
46443    if (element.hasFacility()) {
46444      composeReference("facility", element.getFacility());
46445    }
46446    if (element.hasClaim()) {
46447      composeReference("claim", element.getClaim());
46448    }
46449    if (element.hasClaimResponse()) {
46450      composeReference("claimResponse", element.getClaimResponse());
46451    }
46452    if (element.hasOutcomeElement()) {
46453      composeEnumerationCore("outcome", element.getOutcomeElement(),
46454          new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
46455      composeEnumerationExtras("outcome", element.getOutcomeElement(),
46456          new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
46457    }
46458    if (element.hasDispositionElement()) {
46459      composeStringCore("disposition", element.getDispositionElement(), false);
46460      composeStringExtras("disposition", element.getDispositionElement(), false);
46461    }
46462    if (element.hasPreAuthRef()) {
46463      openArray("preAuthRef");
46464      for (StringType e : element.getPreAuthRef())
46465        composeStringCore(null, e, true);
46466      closeArray();
46467      if (anyHasExtras(element.getPreAuthRef())) {
46468        openArray("_preAuthRef");
46469        for (StringType e : element.getPreAuthRef())
46470          composeStringExtras(null, e, true);
46471        closeArray();
46472      }
46473    }
46474    ;
46475    if (element.hasPreAuthRefPeriod()) {
46476      openArray("preAuthRefPeriod");
46477      for (Period e : element.getPreAuthRefPeriod())
46478        composePeriod(null, e);
46479      closeArray();
46480    }
46481    ;
46482    if (element.hasCareTeam()) {
46483      openArray("careTeam");
46484      for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam())
46485        composeExplanationOfBenefitCareTeamComponent(null, e);
46486      closeArray();
46487    }
46488    ;
46489    if (element.hasSupportingInfo()) {
46490      openArray("supportingInfo");
46491      for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo())
46492        composeExplanationOfBenefitSupportingInformationComponent(null, e);
46493      closeArray();
46494    }
46495    ;
46496    if (element.hasDiagnosis()) {
46497      openArray("diagnosis");
46498      for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis())
46499        composeExplanationOfBenefitDiagnosisComponent(null, e);
46500      closeArray();
46501    }
46502    ;
46503    if (element.hasProcedure()) {
46504      openArray("procedure");
46505      for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure())
46506        composeExplanationOfBenefitProcedureComponent(null, e);
46507      closeArray();
46508    }
46509    ;
46510    if (element.hasPrecedenceElement()) {
46511      composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
46512      composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
46513    }
46514    if (element.hasInsurance()) {
46515      openArray("insurance");
46516      for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance())
46517        composeExplanationOfBenefitInsuranceComponent(null, e);
46518      closeArray();
46519    }
46520    ;
46521    if (element.hasAccident()) {
46522      composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
46523    }
46524    if (element.hasItem()) {
46525      openArray("item");
46526      for (ExplanationOfBenefit.ItemComponent e : element.getItem())
46527        composeExplanationOfBenefitItemComponent(null, e);
46528      closeArray();
46529    }
46530    ;
46531    if (element.hasAddItem()) {
46532      openArray("addItem");
46533      for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem())
46534        composeExplanationOfBenefitAddedItemComponent(null, e);
46535      closeArray();
46536    }
46537    ;
46538    if (element.hasAdjudication()) {
46539      openArray("adjudication");
46540      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
46541        composeExplanationOfBenefitAdjudicationComponent(null, e);
46542      closeArray();
46543    }
46544    ;
46545    if (element.hasTotal()) {
46546      openArray("total");
46547      for (ExplanationOfBenefit.TotalComponent e : element.getTotal())
46548        composeExplanationOfBenefitTotalComponent(null, e);
46549      closeArray();
46550    }
46551    ;
46552    if (element.hasPayment()) {
46553      composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
46554    }
46555    if (element.hasFormCode()) {
46556      composeCodeableConcept("formCode", element.getFormCode());
46557    }
46558    if (element.hasForm()) {
46559      composeAttachment("form", element.getForm());
46560    }
46561    if (element.hasProcessNote()) {
46562      openArray("processNote");
46563      for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote())
46564        composeExplanationOfBenefitNoteComponent(null, e);
46565      closeArray();
46566    }
46567    ;
46568    if (element.hasBenefitPeriod()) {
46569      composePeriod("benefitPeriod", element.getBenefitPeriod());
46570    }
46571    if (element.hasBenefitBalance()) {
46572      openArray("benefitBalance");
46573      for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance())
46574        composeExplanationOfBenefitBenefitBalanceComponent(null, e);
46575      closeArray();
46576    }
46577    ;
46578  }
46579
46580  protected void composeExplanationOfBenefitRelatedClaimComponent(String name,
46581      ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
46582    if (element != null) {
46583      open(name);
46584      composeExplanationOfBenefitRelatedClaimComponentInner(element);
46585      close();
46586    }
46587  }
46588
46589  protected void composeExplanationOfBenefitRelatedClaimComponentInner(
46590      ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
46591    composeBackbone(element);
46592    if (element.hasClaim()) {
46593      composeReference("claim", element.getClaim());
46594    }
46595    if (element.hasRelationship()) {
46596      composeCodeableConcept("relationship", element.getRelationship());
46597    }
46598    if (element.hasReference()) {
46599      composeIdentifier("reference", element.getReference());
46600    }
46601  }
46602
46603  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element)
46604      throws IOException {
46605    if (element != null) {
46606      open(name);
46607      composeExplanationOfBenefitPayeeComponentInner(element);
46608      close();
46609    }
46610  }
46611
46612  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element)
46613      throws IOException {
46614    composeBackbone(element);
46615    if (element.hasType()) {
46616      composeCodeableConcept("type", element.getType());
46617    }
46618    if (element.hasParty()) {
46619      composeReference("party", element.getParty());
46620    }
46621  }
46622
46623  protected void composeExplanationOfBenefitCareTeamComponent(String name,
46624      ExplanationOfBenefit.CareTeamComponent element) throws IOException {
46625    if (element != null) {
46626      open(name);
46627      composeExplanationOfBenefitCareTeamComponentInner(element);
46628      close();
46629    }
46630  }
46631
46632  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element)
46633      throws IOException {
46634    composeBackbone(element);
46635    if (element.hasSequenceElement()) {
46636      composePositiveIntCore("sequence", element.getSequenceElement(), false);
46637      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
46638    }
46639    if (element.hasProvider()) {
46640      composeReference("provider", element.getProvider());
46641    }
46642    if (element.hasResponsibleElement()) {
46643      composeBooleanCore("responsible", element.getResponsibleElement(), false);
46644      composeBooleanExtras("responsible", element.getResponsibleElement(), false);
46645    }
46646    if (element.hasRole()) {
46647      composeCodeableConcept("role", element.getRole());
46648    }
46649    if (element.hasQualification()) {
46650      composeCodeableConcept("qualification", element.getQualification());
46651    }
46652  }
46653
46654  protected void composeExplanationOfBenefitSupportingInformationComponent(String name,
46655      ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
46656    if (element != null) {
46657      open(name);
46658      composeExplanationOfBenefitSupportingInformationComponentInner(element);
46659      close();
46660    }
46661  }
46662
46663  protected void composeExplanationOfBenefitSupportingInformationComponentInner(
46664      ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
46665    composeBackbone(element);
46666    if (element.hasSequenceElement()) {
46667      composePositiveIntCore("sequence", element.getSequenceElement(), false);
46668      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
46669    }
46670    if (element.hasCategory()) {
46671      composeCodeableConcept("category", element.getCategory());
46672    }
46673    if (element.hasCode()) {
46674      composeCodeableConcept("code", element.getCode());
46675    }
46676    if (element.hasTiming()) {
46677      composeType("timing", element.getTiming());
46678    }
46679    if (element.hasValue()) {
46680      composeType("value", element.getValue());
46681    }
46682    if (element.hasReason()) {
46683      composeCoding("reason", element.getReason());
46684    }
46685  }
46686
46687  protected void composeExplanationOfBenefitDiagnosisComponent(String name,
46688      ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
46689    if (element != null) {
46690      open(name);
46691      composeExplanationOfBenefitDiagnosisComponentInner(element);
46692      close();
46693    }
46694  }
46695
46696  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element)
46697      throws IOException {
46698    composeBackbone(element);
46699    if (element.hasSequenceElement()) {
46700      composePositiveIntCore("sequence", element.getSequenceElement(), false);
46701      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
46702    }
46703    if (element.hasDiagnosis()) {
46704      composeType("diagnosis", element.getDiagnosis());
46705    }
46706    if (element.hasType()) {
46707      openArray("type");
46708      for (CodeableConcept e : element.getType())
46709        composeCodeableConcept(null, e);
46710      closeArray();
46711    }
46712    ;
46713    if (element.hasOnAdmission()) {
46714      composeCodeableConcept("onAdmission", element.getOnAdmission());
46715    }
46716    if (element.hasPackageCode()) {
46717      composeCodeableConcept("packageCode", element.getPackageCode());
46718    }
46719  }
46720
46721  protected void composeExplanationOfBenefitProcedureComponent(String name,
46722      ExplanationOfBenefit.ProcedureComponent element) throws IOException {
46723    if (element != null) {
46724      open(name);
46725      composeExplanationOfBenefitProcedureComponentInner(element);
46726      close();
46727    }
46728  }
46729
46730  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element)
46731      throws IOException {
46732    composeBackbone(element);
46733    if (element.hasSequenceElement()) {
46734      composePositiveIntCore("sequence", element.getSequenceElement(), false);
46735      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
46736    }
46737    if (element.hasType()) {
46738      openArray("type");
46739      for (CodeableConcept e : element.getType())
46740        composeCodeableConcept(null, e);
46741      closeArray();
46742    }
46743    ;
46744    if (element.hasDateElement()) {
46745      composeDateTimeCore("date", element.getDateElement(), false);
46746      composeDateTimeExtras("date", element.getDateElement(), false);
46747    }
46748    if (element.hasProcedure()) {
46749      composeType("procedure", element.getProcedure());
46750    }
46751    if (element.hasUdi()) {
46752      openArray("udi");
46753      for (Reference e : element.getUdi())
46754        composeReference(null, e);
46755      closeArray();
46756    }
46757    ;
46758  }
46759
46760  protected void composeExplanationOfBenefitInsuranceComponent(String name,
46761      ExplanationOfBenefit.InsuranceComponent element) throws IOException {
46762    if (element != null) {
46763      open(name);
46764      composeExplanationOfBenefitInsuranceComponentInner(element);
46765      close();
46766    }
46767  }
46768
46769  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element)
46770      throws IOException {
46771    composeBackbone(element);
46772    if (element.hasFocalElement()) {
46773      composeBooleanCore("focal", element.getFocalElement(), false);
46774      composeBooleanExtras("focal", element.getFocalElement(), false);
46775    }
46776    if (element.hasCoverage()) {
46777      composeReference("coverage", element.getCoverage());
46778    }
46779    if (element.hasPreAuthRef()) {
46780      openArray("preAuthRef");
46781      for (StringType e : element.getPreAuthRef())
46782        composeStringCore(null, e, true);
46783      closeArray();
46784      if (anyHasExtras(element.getPreAuthRef())) {
46785        openArray("_preAuthRef");
46786        for (StringType e : element.getPreAuthRef())
46787          composeStringExtras(null, e, true);
46788        closeArray();
46789      }
46790    }
46791    ;
46792  }
46793
46794  protected void composeExplanationOfBenefitAccidentComponent(String name,
46795      ExplanationOfBenefit.AccidentComponent element) throws IOException {
46796    if (element != null) {
46797      open(name);
46798      composeExplanationOfBenefitAccidentComponentInner(element);
46799      close();
46800    }
46801  }
46802
46803  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element)
46804      throws IOException {
46805    composeBackbone(element);
46806    if (element.hasDateElement()) {
46807      composeDateCore("date", element.getDateElement(), false);
46808      composeDateExtras("date", element.getDateElement(), false);
46809    }
46810    if (element.hasType()) {
46811      composeCodeableConcept("type", element.getType());
46812    }
46813    if (element.hasLocation()) {
46814      composeType("location", element.getLocation());
46815    }
46816  }
46817
46818  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element)
46819      throws IOException {
46820    if (element != null) {
46821      open(name);
46822      composeExplanationOfBenefitItemComponentInner(element);
46823      close();
46824    }
46825  }
46826
46827  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element)
46828      throws IOException {
46829    composeBackbone(element);
46830    if (element.hasSequenceElement()) {
46831      composePositiveIntCore("sequence", element.getSequenceElement(), false);
46832      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
46833    }
46834    if (element.hasCareTeamSequence()) {
46835      openArray("careTeamSequence");
46836      for (PositiveIntType e : element.getCareTeamSequence())
46837        composePositiveIntCore(null, e, true);
46838      closeArray();
46839      if (anyHasExtras(element.getCareTeamSequence())) {
46840        openArray("_careTeamSequence");
46841        for (PositiveIntType e : element.getCareTeamSequence())
46842          composePositiveIntExtras(null, e, true);
46843        closeArray();
46844      }
46845    }
46846    ;
46847    if (element.hasDiagnosisSequence()) {
46848      openArray("diagnosisSequence");
46849      for (PositiveIntType e : element.getDiagnosisSequence())
46850        composePositiveIntCore(null, e, true);
46851      closeArray();
46852      if (anyHasExtras(element.getDiagnosisSequence())) {
46853        openArray("_diagnosisSequence");
46854        for (PositiveIntType e : element.getDiagnosisSequence())
46855          composePositiveIntExtras(null, e, true);
46856        closeArray();
46857      }
46858    }
46859    ;
46860    if (element.hasProcedureSequence()) {
46861      openArray("procedureSequence");
46862      for (PositiveIntType e : element.getProcedureSequence())
46863        composePositiveIntCore(null, e, true);
46864      closeArray();
46865      if (anyHasExtras(element.getProcedureSequence())) {
46866        openArray("_procedureSequence");
46867        for (PositiveIntType e : element.getProcedureSequence())
46868          composePositiveIntExtras(null, e, true);
46869        closeArray();
46870      }
46871    }
46872    ;
46873    if (element.hasInformationSequence()) {
46874      openArray("informationSequence");
46875      for (PositiveIntType e : element.getInformationSequence())
46876        composePositiveIntCore(null, e, true);
46877      closeArray();
46878      if (anyHasExtras(element.getInformationSequence())) {
46879        openArray("_informationSequence");
46880        for (PositiveIntType e : element.getInformationSequence())
46881          composePositiveIntExtras(null, e, true);
46882        closeArray();
46883      }
46884    }
46885    ;
46886    if (element.hasRevenue()) {
46887      composeCodeableConcept("revenue", element.getRevenue());
46888    }
46889    if (element.hasCategory()) {
46890      composeCodeableConcept("category", element.getCategory());
46891    }
46892    if (element.hasProductOrService()) {
46893      composeCodeableConcept("productOrService", element.getProductOrService());
46894    }
46895    if (element.hasModifier()) {
46896      openArray("modifier");
46897      for (CodeableConcept e : element.getModifier())
46898        composeCodeableConcept(null, e);
46899      closeArray();
46900    }
46901    ;
46902    if (element.hasProgramCode()) {
46903      openArray("programCode");
46904      for (CodeableConcept e : element.getProgramCode())
46905        composeCodeableConcept(null, e);
46906      closeArray();
46907    }
46908    ;
46909    if (element.hasServiced()) {
46910      composeType("serviced", element.getServiced());
46911    }
46912    if (element.hasLocation()) {
46913      composeType("location", element.getLocation());
46914    }
46915    if (element.hasQuantity()) {
46916      composeQuantity("quantity", element.getQuantity());
46917    }
46918    if (element.hasUnitPrice()) {
46919      composeMoney("unitPrice", element.getUnitPrice());
46920    }
46921    if (element.hasFactorElement()) {
46922      composeDecimalCore("factor", element.getFactorElement(), false);
46923      composeDecimalExtras("factor", element.getFactorElement(), false);
46924    }
46925    if (element.hasNet()) {
46926      composeMoney("net", element.getNet());
46927    }
46928    if (element.hasUdi()) {
46929      openArray("udi");
46930      for (Reference e : element.getUdi())
46931        composeReference(null, e);
46932      closeArray();
46933    }
46934    ;
46935    if (element.hasBodySite()) {
46936      composeCodeableConcept("bodySite", element.getBodySite());
46937    }
46938    if (element.hasSubSite()) {
46939      openArray("subSite");
46940      for (CodeableConcept e : element.getSubSite())
46941        composeCodeableConcept(null, e);
46942      closeArray();
46943    }
46944    ;
46945    if (element.hasEncounter()) {
46946      openArray("encounter");
46947      for (Reference e : element.getEncounter())
46948        composeReference(null, e);
46949      closeArray();
46950    }
46951    ;
46952    if (element.hasNoteNumber()) {
46953      openArray("noteNumber");
46954      for (PositiveIntType e : element.getNoteNumber())
46955        composePositiveIntCore(null, e, true);
46956      closeArray();
46957      if (anyHasExtras(element.getNoteNumber())) {
46958        openArray("_noteNumber");
46959        for (PositiveIntType e : element.getNoteNumber())
46960          composePositiveIntExtras(null, e, true);
46961        closeArray();
46962      }
46963    }
46964    ;
46965    if (element.hasAdjudication()) {
46966      openArray("adjudication");
46967      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
46968        composeExplanationOfBenefitAdjudicationComponent(null, e);
46969      closeArray();
46970    }
46971    ;
46972    if (element.hasDetail()) {
46973      openArray("detail");
46974      for (ExplanationOfBenefit.DetailComponent e : element.getDetail())
46975        composeExplanationOfBenefitDetailComponent(null, e);
46976      closeArray();
46977    }
46978    ;
46979  }
46980
46981  protected void composeExplanationOfBenefitAdjudicationComponent(String name,
46982      ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
46983    if (element != null) {
46984      open(name);
46985      composeExplanationOfBenefitAdjudicationComponentInner(element);
46986      close();
46987    }
46988  }
46989
46990  protected void composeExplanationOfBenefitAdjudicationComponentInner(
46991      ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
46992    composeBackbone(element);
46993    if (element.hasCategory()) {
46994      composeCodeableConcept("category", element.getCategory());
46995    }
46996    if (element.hasReason()) {
46997      composeCodeableConcept("reason", element.getReason());
46998    }
46999    if (element.hasAmount()) {
47000      composeMoney("amount", element.getAmount());
47001    }
47002    if (element.hasValueElement()) {
47003      composeDecimalCore("value", element.getValueElement(), false);
47004      composeDecimalExtras("value", element.getValueElement(), false);
47005    }
47006  }
47007
47008  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element)
47009      throws IOException {
47010    if (element != null) {
47011      open(name);
47012      composeExplanationOfBenefitDetailComponentInner(element);
47013      close();
47014    }
47015  }
47016
47017  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element)
47018      throws IOException {
47019    composeBackbone(element);
47020    if (element.hasSequenceElement()) {
47021      composePositiveIntCore("sequence", element.getSequenceElement(), false);
47022      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
47023    }
47024    if (element.hasRevenue()) {
47025      composeCodeableConcept("revenue", element.getRevenue());
47026    }
47027    if (element.hasCategory()) {
47028      composeCodeableConcept("category", element.getCategory());
47029    }
47030    if (element.hasProductOrService()) {
47031      composeCodeableConcept("productOrService", element.getProductOrService());
47032    }
47033    if (element.hasModifier()) {
47034      openArray("modifier");
47035      for (CodeableConcept e : element.getModifier())
47036        composeCodeableConcept(null, e);
47037      closeArray();
47038    }
47039    ;
47040    if (element.hasProgramCode()) {
47041      openArray("programCode");
47042      for (CodeableConcept e : element.getProgramCode())
47043        composeCodeableConcept(null, e);
47044      closeArray();
47045    }
47046    ;
47047    if (element.hasQuantity()) {
47048      composeQuantity("quantity", element.getQuantity());
47049    }
47050    if (element.hasUnitPrice()) {
47051      composeMoney("unitPrice", element.getUnitPrice());
47052    }
47053    if (element.hasFactorElement()) {
47054      composeDecimalCore("factor", element.getFactorElement(), false);
47055      composeDecimalExtras("factor", element.getFactorElement(), false);
47056    }
47057    if (element.hasNet()) {
47058      composeMoney("net", element.getNet());
47059    }
47060    if (element.hasUdi()) {
47061      openArray("udi");
47062      for (Reference e : element.getUdi())
47063        composeReference(null, e);
47064      closeArray();
47065    }
47066    ;
47067    if (element.hasNoteNumber()) {
47068      openArray("noteNumber");
47069      for (PositiveIntType e : element.getNoteNumber())
47070        composePositiveIntCore(null, e, true);
47071      closeArray();
47072      if (anyHasExtras(element.getNoteNumber())) {
47073        openArray("_noteNumber");
47074        for (PositiveIntType e : element.getNoteNumber())
47075          composePositiveIntExtras(null, e, true);
47076        closeArray();
47077      }
47078    }
47079    ;
47080    if (element.hasAdjudication()) {
47081      openArray("adjudication");
47082      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
47083        composeExplanationOfBenefitAdjudicationComponent(null, e);
47084      closeArray();
47085    }
47086    ;
47087    if (element.hasSubDetail()) {
47088      openArray("subDetail");
47089      for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail())
47090        composeExplanationOfBenefitSubDetailComponent(null, e);
47091      closeArray();
47092    }
47093    ;
47094  }
47095
47096  protected void composeExplanationOfBenefitSubDetailComponent(String name,
47097      ExplanationOfBenefit.SubDetailComponent element) throws IOException {
47098    if (element != null) {
47099      open(name);
47100      composeExplanationOfBenefitSubDetailComponentInner(element);
47101      close();
47102    }
47103  }
47104
47105  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element)
47106      throws IOException {
47107    composeBackbone(element);
47108    if (element.hasSequenceElement()) {
47109      composePositiveIntCore("sequence", element.getSequenceElement(), false);
47110      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
47111    }
47112    if (element.hasRevenue()) {
47113      composeCodeableConcept("revenue", element.getRevenue());
47114    }
47115    if (element.hasCategory()) {
47116      composeCodeableConcept("category", element.getCategory());
47117    }
47118    if (element.hasProductOrService()) {
47119      composeCodeableConcept("productOrService", element.getProductOrService());
47120    }
47121    if (element.hasModifier()) {
47122      openArray("modifier");
47123      for (CodeableConcept e : element.getModifier())
47124        composeCodeableConcept(null, e);
47125      closeArray();
47126    }
47127    ;
47128    if (element.hasProgramCode()) {
47129      openArray("programCode");
47130      for (CodeableConcept e : element.getProgramCode())
47131        composeCodeableConcept(null, e);
47132      closeArray();
47133    }
47134    ;
47135    if (element.hasQuantity()) {
47136      composeQuantity("quantity", element.getQuantity());
47137    }
47138    if (element.hasUnitPrice()) {
47139      composeMoney("unitPrice", element.getUnitPrice());
47140    }
47141    if (element.hasFactorElement()) {
47142      composeDecimalCore("factor", element.getFactorElement(), false);
47143      composeDecimalExtras("factor", element.getFactorElement(), false);
47144    }
47145    if (element.hasNet()) {
47146      composeMoney("net", element.getNet());
47147    }
47148    if (element.hasUdi()) {
47149      openArray("udi");
47150      for (Reference e : element.getUdi())
47151        composeReference(null, e);
47152      closeArray();
47153    }
47154    ;
47155    if (element.hasNoteNumber()) {
47156      openArray("noteNumber");
47157      for (PositiveIntType e : element.getNoteNumber())
47158        composePositiveIntCore(null, e, true);
47159      closeArray();
47160      if (anyHasExtras(element.getNoteNumber())) {
47161        openArray("_noteNumber");
47162        for (PositiveIntType e : element.getNoteNumber())
47163          composePositiveIntExtras(null, e, true);
47164        closeArray();
47165      }
47166    }
47167    ;
47168    if (element.hasAdjudication()) {
47169      openArray("adjudication");
47170      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
47171        composeExplanationOfBenefitAdjudicationComponent(null, e);
47172      closeArray();
47173    }
47174    ;
47175  }
47176
47177  protected void composeExplanationOfBenefitAddedItemComponent(String name,
47178      ExplanationOfBenefit.AddedItemComponent element) throws IOException {
47179    if (element != null) {
47180      open(name);
47181      composeExplanationOfBenefitAddedItemComponentInner(element);
47182      close();
47183    }
47184  }
47185
47186  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element)
47187      throws IOException {
47188    composeBackbone(element);
47189    if (element.hasItemSequence()) {
47190      openArray("itemSequence");
47191      for (PositiveIntType e : element.getItemSequence())
47192        composePositiveIntCore(null, e, true);
47193      closeArray();
47194      if (anyHasExtras(element.getItemSequence())) {
47195        openArray("_itemSequence");
47196        for (PositiveIntType e : element.getItemSequence())
47197          composePositiveIntExtras(null, e, true);
47198        closeArray();
47199      }
47200    }
47201    ;
47202    if (element.hasDetailSequence()) {
47203      openArray("detailSequence");
47204      for (PositiveIntType e : element.getDetailSequence())
47205        composePositiveIntCore(null, e, true);
47206      closeArray();
47207      if (anyHasExtras(element.getDetailSequence())) {
47208        openArray("_detailSequence");
47209        for (PositiveIntType e : element.getDetailSequence())
47210          composePositiveIntExtras(null, e, true);
47211        closeArray();
47212      }
47213    }
47214    ;
47215    if (element.hasSubDetailSequence()) {
47216      openArray("subDetailSequence");
47217      for (PositiveIntType e : element.getSubDetailSequence())
47218        composePositiveIntCore(null, e, true);
47219      closeArray();
47220      if (anyHasExtras(element.getSubDetailSequence())) {
47221        openArray("_subDetailSequence");
47222        for (PositiveIntType e : element.getSubDetailSequence())
47223          composePositiveIntExtras(null, e, true);
47224        closeArray();
47225      }
47226    }
47227    ;
47228    if (element.hasProvider()) {
47229      openArray("provider");
47230      for (Reference e : element.getProvider())
47231        composeReference(null, e);
47232      closeArray();
47233    }
47234    ;
47235    if (element.hasProductOrService()) {
47236      composeCodeableConcept("productOrService", element.getProductOrService());
47237    }
47238    if (element.hasModifier()) {
47239      openArray("modifier");
47240      for (CodeableConcept e : element.getModifier())
47241        composeCodeableConcept(null, e);
47242      closeArray();
47243    }
47244    ;
47245    if (element.hasProgramCode()) {
47246      openArray("programCode");
47247      for (CodeableConcept e : element.getProgramCode())
47248        composeCodeableConcept(null, e);
47249      closeArray();
47250    }
47251    ;
47252    if (element.hasServiced()) {
47253      composeType("serviced", element.getServiced());
47254    }
47255    if (element.hasLocation()) {
47256      composeType("location", element.getLocation());
47257    }
47258    if (element.hasQuantity()) {
47259      composeQuantity("quantity", element.getQuantity());
47260    }
47261    if (element.hasUnitPrice()) {
47262      composeMoney("unitPrice", element.getUnitPrice());
47263    }
47264    if (element.hasFactorElement()) {
47265      composeDecimalCore("factor", element.getFactorElement(), false);
47266      composeDecimalExtras("factor", element.getFactorElement(), false);
47267    }
47268    if (element.hasNet()) {
47269      composeMoney("net", element.getNet());
47270    }
47271    if (element.hasBodySite()) {
47272      composeCodeableConcept("bodySite", element.getBodySite());
47273    }
47274    if (element.hasSubSite()) {
47275      openArray("subSite");
47276      for (CodeableConcept e : element.getSubSite())
47277        composeCodeableConcept(null, e);
47278      closeArray();
47279    }
47280    ;
47281    if (element.hasNoteNumber()) {
47282      openArray("noteNumber");
47283      for (PositiveIntType e : element.getNoteNumber())
47284        composePositiveIntCore(null, e, true);
47285      closeArray();
47286      if (anyHasExtras(element.getNoteNumber())) {
47287        openArray("_noteNumber");
47288        for (PositiveIntType e : element.getNoteNumber())
47289          composePositiveIntExtras(null, e, true);
47290        closeArray();
47291      }
47292    }
47293    ;
47294    if (element.hasAdjudication()) {
47295      openArray("adjudication");
47296      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
47297        composeExplanationOfBenefitAdjudicationComponent(null, e);
47298      closeArray();
47299    }
47300    ;
47301    if (element.hasDetail()) {
47302      openArray("detail");
47303      for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail())
47304        composeExplanationOfBenefitAddedItemDetailComponent(null, e);
47305      closeArray();
47306    }
47307    ;
47308  }
47309
47310  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name,
47311      ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
47312    if (element != null) {
47313      open(name);
47314      composeExplanationOfBenefitAddedItemDetailComponentInner(element);
47315      close();
47316    }
47317  }
47318
47319  protected void composeExplanationOfBenefitAddedItemDetailComponentInner(
47320      ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
47321    composeBackbone(element);
47322    if (element.hasProductOrService()) {
47323      composeCodeableConcept("productOrService", element.getProductOrService());
47324    }
47325    if (element.hasModifier()) {
47326      openArray("modifier");
47327      for (CodeableConcept e : element.getModifier())
47328        composeCodeableConcept(null, e);
47329      closeArray();
47330    }
47331    ;
47332    if (element.hasQuantity()) {
47333      composeQuantity("quantity", element.getQuantity());
47334    }
47335    if (element.hasUnitPrice()) {
47336      composeMoney("unitPrice", element.getUnitPrice());
47337    }
47338    if (element.hasFactorElement()) {
47339      composeDecimalCore("factor", element.getFactorElement(), false);
47340      composeDecimalExtras("factor", element.getFactorElement(), false);
47341    }
47342    if (element.hasNet()) {
47343      composeMoney("net", element.getNet());
47344    }
47345    if (element.hasNoteNumber()) {
47346      openArray("noteNumber");
47347      for (PositiveIntType e : element.getNoteNumber())
47348        composePositiveIntCore(null, e, true);
47349      closeArray();
47350      if (anyHasExtras(element.getNoteNumber())) {
47351        openArray("_noteNumber");
47352        for (PositiveIntType e : element.getNoteNumber())
47353          composePositiveIntExtras(null, e, true);
47354        closeArray();
47355      }
47356    }
47357    ;
47358    if (element.hasAdjudication()) {
47359      openArray("adjudication");
47360      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
47361        composeExplanationOfBenefitAdjudicationComponent(null, e);
47362      closeArray();
47363    }
47364    ;
47365    if (element.hasSubDetail()) {
47366      openArray("subDetail");
47367      for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail())
47368        composeExplanationOfBenefitAddedItemDetailSubDetailComponent(null, e);
47369      closeArray();
47370    }
47371    ;
47372  }
47373
47374  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name,
47375      ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
47376    if (element != null) {
47377      open(name);
47378      composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(element);
47379      close();
47380    }
47381  }
47382
47383  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(
47384      ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
47385    composeBackbone(element);
47386    if (element.hasProductOrService()) {
47387      composeCodeableConcept("productOrService", element.getProductOrService());
47388    }
47389    if (element.hasModifier()) {
47390      openArray("modifier");
47391      for (CodeableConcept e : element.getModifier())
47392        composeCodeableConcept(null, e);
47393      closeArray();
47394    }
47395    ;
47396    if (element.hasQuantity()) {
47397      composeQuantity("quantity", element.getQuantity());
47398    }
47399    if (element.hasUnitPrice()) {
47400      composeMoney("unitPrice", element.getUnitPrice());
47401    }
47402    if (element.hasFactorElement()) {
47403      composeDecimalCore("factor", element.getFactorElement(), false);
47404      composeDecimalExtras("factor", element.getFactorElement(), false);
47405    }
47406    if (element.hasNet()) {
47407      composeMoney("net", element.getNet());
47408    }
47409    if (element.hasNoteNumber()) {
47410      openArray("noteNumber");
47411      for (PositiveIntType e : element.getNoteNumber())
47412        composePositiveIntCore(null, e, true);
47413      closeArray();
47414      if (anyHasExtras(element.getNoteNumber())) {
47415        openArray("_noteNumber");
47416        for (PositiveIntType e : element.getNoteNumber())
47417          composePositiveIntExtras(null, e, true);
47418        closeArray();
47419      }
47420    }
47421    ;
47422    if (element.hasAdjudication()) {
47423      openArray("adjudication");
47424      for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication())
47425        composeExplanationOfBenefitAdjudicationComponent(null, e);
47426      closeArray();
47427    }
47428    ;
47429  }
47430
47431  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element)
47432      throws IOException {
47433    if (element != null) {
47434      open(name);
47435      composeExplanationOfBenefitTotalComponentInner(element);
47436      close();
47437    }
47438  }
47439
47440  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element)
47441      throws IOException {
47442    composeBackbone(element);
47443    if (element.hasCategory()) {
47444      composeCodeableConcept("category", element.getCategory());
47445    }
47446    if (element.hasAmount()) {
47447      composeMoney("amount", element.getAmount());
47448    }
47449  }
47450
47451  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element)
47452      throws IOException {
47453    if (element != null) {
47454      open(name);
47455      composeExplanationOfBenefitPaymentComponentInner(element);
47456      close();
47457    }
47458  }
47459
47460  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element)
47461      throws IOException {
47462    composeBackbone(element);
47463    if (element.hasType()) {
47464      composeCodeableConcept("type", element.getType());
47465    }
47466    if (element.hasAdjustment()) {
47467      composeMoney("adjustment", element.getAdjustment());
47468    }
47469    if (element.hasAdjustmentReason()) {
47470      composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
47471    }
47472    if (element.hasDateElement()) {
47473      composeDateCore("date", element.getDateElement(), false);
47474      composeDateExtras("date", element.getDateElement(), false);
47475    }
47476    if (element.hasAmount()) {
47477      composeMoney("amount", element.getAmount());
47478    }
47479    if (element.hasIdentifier()) {
47480      composeIdentifier("identifier", element.getIdentifier());
47481    }
47482  }
47483
47484  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element)
47485      throws IOException {
47486    if (element != null) {
47487      open(name);
47488      composeExplanationOfBenefitNoteComponentInner(element);
47489      close();
47490    }
47491  }
47492
47493  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element)
47494      throws IOException {
47495    composeBackbone(element);
47496    if (element.hasNumberElement()) {
47497      composePositiveIntCore("number", element.getNumberElement(), false);
47498      composePositiveIntExtras("number", element.getNumberElement(), false);
47499    }
47500    if (element.hasTypeElement()) {
47501      composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
47502      composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
47503    }
47504    if (element.hasTextElement()) {
47505      composeStringCore("text", element.getTextElement(), false);
47506      composeStringExtras("text", element.getTextElement(), false);
47507    }
47508    if (element.hasLanguage()) {
47509      composeCodeableConcept("language", element.getLanguage());
47510    }
47511  }
47512
47513  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name,
47514      ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
47515    if (element != null) {
47516      open(name);
47517      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
47518      close();
47519    }
47520  }
47521
47522  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(
47523      ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
47524    composeBackbone(element);
47525    if (element.hasCategory()) {
47526      composeCodeableConcept("category", element.getCategory());
47527    }
47528    if (element.hasExcludedElement()) {
47529      composeBooleanCore("excluded", element.getExcludedElement(), false);
47530      composeBooleanExtras("excluded", element.getExcludedElement(), false);
47531    }
47532    if (element.hasNameElement()) {
47533      composeStringCore("name", element.getNameElement(), false);
47534      composeStringExtras("name", element.getNameElement(), false);
47535    }
47536    if (element.hasDescriptionElement()) {
47537      composeStringCore("description", element.getDescriptionElement(), false);
47538      composeStringExtras("description", element.getDescriptionElement(), false);
47539    }
47540    if (element.hasNetwork()) {
47541      composeCodeableConcept("network", element.getNetwork());
47542    }
47543    if (element.hasUnit()) {
47544      composeCodeableConcept("unit", element.getUnit());
47545    }
47546    if (element.hasTerm()) {
47547      composeCodeableConcept("term", element.getTerm());
47548    }
47549    if (element.hasFinancial()) {
47550      openArray("financial");
47551      for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial())
47552        composeExplanationOfBenefitBenefitComponent(null, e);
47553      closeArray();
47554    }
47555    ;
47556  }
47557
47558  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element)
47559      throws IOException {
47560    if (element != null) {
47561      open(name);
47562      composeExplanationOfBenefitBenefitComponentInner(element);
47563      close();
47564    }
47565  }
47566
47567  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element)
47568      throws IOException {
47569    composeBackbone(element);
47570    if (element.hasType()) {
47571      composeCodeableConcept("type", element.getType());
47572    }
47573    if (element.hasAllowed()) {
47574      composeType("allowed", element.getAllowed());
47575    }
47576    if (element.hasUsed()) {
47577      composeType("used", element.getUsed());
47578    }
47579  }
47580
47581  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
47582    if (element != null) {
47583      prop("resourceType", name);
47584      composeFamilyMemberHistoryInner(element);
47585    }
47586  }
47587
47588  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
47589    composeDomainResourceElements(element);
47590    if (element.hasIdentifier()) {
47591      openArray("identifier");
47592      for (Identifier e : element.getIdentifier())
47593        composeIdentifier(null, e);
47594      closeArray();
47595    }
47596    ;
47597    if (element.hasInstantiatesCanonical()) {
47598      openArray("instantiatesCanonical");
47599      for (CanonicalType e : element.getInstantiatesCanonical())
47600        composeCanonicalCore(null, e, true);
47601      closeArray();
47602      if (anyHasExtras(element.getInstantiatesCanonical())) {
47603        openArray("_instantiatesCanonical");
47604        for (CanonicalType e : element.getInstantiatesCanonical())
47605          composeCanonicalExtras(null, e, true);
47606        closeArray();
47607      }
47608    }
47609    ;
47610    if (element.hasInstantiatesUri()) {
47611      openArray("instantiatesUri");
47612      for (UriType e : element.getInstantiatesUri())
47613        composeUriCore(null, e, true);
47614      closeArray();
47615      if (anyHasExtras(element.getInstantiatesUri())) {
47616        openArray("_instantiatesUri");
47617        for (UriType e : element.getInstantiatesUri())
47618          composeUriExtras(null, e, true);
47619        closeArray();
47620      }
47621    }
47622    ;
47623    if (element.hasStatusElement()) {
47624      composeEnumerationCore("status", element.getStatusElement(),
47625          new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
47626      composeEnumerationExtras("status", element.getStatusElement(),
47627          new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
47628    }
47629    if (element.hasDataAbsentReason()) {
47630      composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
47631    }
47632    if (element.hasPatient()) {
47633      composeReference("patient", element.getPatient());
47634    }
47635    if (element.hasDateElement()) {
47636      composeDateTimeCore("date", element.getDateElement(), false);
47637      composeDateTimeExtras("date", element.getDateElement(), false);
47638    }
47639    if (element.hasNameElement()) {
47640      composeStringCore("name", element.getNameElement(), false);
47641      composeStringExtras("name", element.getNameElement(), false);
47642    }
47643    if (element.hasRelationship()) {
47644      composeCodeableConcept("relationship", element.getRelationship());
47645    }
47646    if (element.hasSex()) {
47647      composeCodeableConcept("sex", element.getSex());
47648    }
47649    if (element.hasBorn()) {
47650      composeType("born", element.getBorn());
47651    }
47652    if (element.hasAge()) {
47653      composeType("age", element.getAge());
47654    }
47655    if (element.hasEstimatedAgeElement()) {
47656      composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
47657      composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
47658    }
47659    if (element.hasDeceased()) {
47660      composeType("deceased", element.getDeceased());
47661    }
47662    if (element.hasReasonCode()) {
47663      openArray("reasonCode");
47664      for (CodeableConcept e : element.getReasonCode())
47665        composeCodeableConcept(null, e);
47666      closeArray();
47667    }
47668    ;
47669    if (element.hasReasonReference()) {
47670      openArray("reasonReference");
47671      for (Reference e : element.getReasonReference())
47672        composeReference(null, e);
47673      closeArray();
47674    }
47675    ;
47676    if (element.hasNote()) {
47677      openArray("note");
47678      for (Annotation e : element.getNote())
47679        composeAnnotation(null, e);
47680      closeArray();
47681    }
47682    ;
47683    if (element.hasCondition()) {
47684      openArray("condition");
47685      for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition())
47686        composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
47687      closeArray();
47688    }
47689    ;
47690  }
47691
47692  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name,
47693      FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
47694    if (element != null) {
47695      open(name);
47696      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
47697      close();
47698    }
47699  }
47700
47701  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(
47702      FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
47703    composeBackbone(element);
47704    if (element.hasCode()) {
47705      composeCodeableConcept("code", element.getCode());
47706    }
47707    if (element.hasOutcome()) {
47708      composeCodeableConcept("outcome", element.getOutcome());
47709    }
47710    if (element.hasContributedToDeathElement()) {
47711      composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
47712      composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
47713    }
47714    if (element.hasOnset()) {
47715      composeType("onset", element.getOnset());
47716    }
47717    if (element.hasNote()) {
47718      openArray("note");
47719      for (Annotation e : element.getNote())
47720        composeAnnotation(null, e);
47721      closeArray();
47722    }
47723    ;
47724  }
47725
47726  protected void composeFlag(String name, Flag element) throws IOException {
47727    if (element != null) {
47728      prop("resourceType", name);
47729      composeFlagInner(element);
47730    }
47731  }
47732
47733  protected void composeFlagInner(Flag element) throws IOException {
47734    composeDomainResourceElements(element);
47735    if (element.hasIdentifier()) {
47736      openArray("identifier");
47737      for (Identifier e : element.getIdentifier())
47738        composeIdentifier(null, e);
47739      closeArray();
47740    }
47741    ;
47742    if (element.hasStatusElement()) {
47743      composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
47744      composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
47745    }
47746    if (element.hasCategory()) {
47747      openArray("category");
47748      for (CodeableConcept e : element.getCategory())
47749        composeCodeableConcept(null, e);
47750      closeArray();
47751    }
47752    ;
47753    if (element.hasCode()) {
47754      composeCodeableConcept("code", element.getCode());
47755    }
47756    if (element.hasSubject()) {
47757      composeReference("subject", element.getSubject());
47758    }
47759    if (element.hasPeriod()) {
47760      composePeriod("period", element.getPeriod());
47761    }
47762    if (element.hasEncounter()) {
47763      composeReference("encounter", element.getEncounter());
47764    }
47765    if (element.hasAuthor()) {
47766      composeReference("author", element.getAuthor());
47767    }
47768  }
47769
47770  protected void composeGoal(String name, Goal element) throws IOException {
47771    if (element != null) {
47772      prop("resourceType", name);
47773      composeGoalInner(element);
47774    }
47775  }
47776
47777  protected void composeGoalInner(Goal element) throws IOException {
47778    composeDomainResourceElements(element);
47779    if (element.hasIdentifier()) {
47780      openArray("identifier");
47781      for (Identifier e : element.getIdentifier())
47782        composeIdentifier(null, e);
47783      closeArray();
47784    }
47785    ;
47786    if (element.hasLifecycleStatusElement()) {
47787      composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(),
47788          new Goal.GoalLifecycleStatusEnumFactory(), false);
47789      composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(),
47790          new Goal.GoalLifecycleStatusEnumFactory(), false);
47791    }
47792    if (element.hasAchievementStatus()) {
47793      composeCodeableConcept("achievementStatus", element.getAchievementStatus());
47794    }
47795    if (element.hasCategory()) {
47796      openArray("category");
47797      for (CodeableConcept e : element.getCategory())
47798        composeCodeableConcept(null, e);
47799      closeArray();
47800    }
47801    ;
47802    if (element.hasPriority()) {
47803      composeCodeableConcept("priority", element.getPriority());
47804    }
47805    if (element.hasDescription()) {
47806      composeCodeableConcept("description", element.getDescription());
47807    }
47808    if (element.hasSubject()) {
47809      composeReference("subject", element.getSubject());
47810    }
47811    if (element.hasStart()) {
47812      composeType("start", element.getStart());
47813    }
47814    if (element.hasTarget()) {
47815      openArray("target");
47816      for (Goal.GoalTargetComponent e : element.getTarget())
47817        composeGoalGoalTargetComponent(null, e);
47818      closeArray();
47819    }
47820    ;
47821    if (element.hasStatusDateElement()) {
47822      composeDateCore("statusDate", element.getStatusDateElement(), false);
47823      composeDateExtras("statusDate", element.getStatusDateElement(), false);
47824    }
47825    if (element.hasStatusReasonElement()) {
47826      composeStringCore("statusReason", element.getStatusReasonElement(), false);
47827      composeStringExtras("statusReason", element.getStatusReasonElement(), false);
47828    }
47829    if (element.hasExpressedBy()) {
47830      composeReference("expressedBy", element.getExpressedBy());
47831    }
47832    if (element.hasAddresses()) {
47833      openArray("addresses");
47834      for (Reference e : element.getAddresses())
47835        composeReference(null, e);
47836      closeArray();
47837    }
47838    ;
47839    if (element.hasNote()) {
47840      openArray("note");
47841      for (Annotation e : element.getNote())
47842        composeAnnotation(null, e);
47843      closeArray();
47844    }
47845    ;
47846    if (element.hasOutcomeCode()) {
47847      openArray("outcomeCode");
47848      for (CodeableConcept e : element.getOutcomeCode())
47849        composeCodeableConcept(null, e);
47850      closeArray();
47851    }
47852    ;
47853    if (element.hasOutcomeReference()) {
47854      openArray("outcomeReference");
47855      for (Reference e : element.getOutcomeReference())
47856        composeReference(null, e);
47857      closeArray();
47858    }
47859    ;
47860  }
47861
47862  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
47863    if (element != null) {
47864      open(name);
47865      composeGoalGoalTargetComponentInner(element);
47866      close();
47867    }
47868  }
47869
47870  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
47871    composeBackbone(element);
47872    if (element.hasMeasure()) {
47873      composeCodeableConcept("measure", element.getMeasure());
47874    }
47875    if (element.hasDetail()) {
47876      composeType("detail", element.getDetail());
47877    }
47878    if (element.hasDue()) {
47879      composeType("due", element.getDue());
47880    }
47881  }
47882
47883  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
47884    if (element != null) {
47885      prop("resourceType", name);
47886      composeGraphDefinitionInner(element);
47887    }
47888  }
47889
47890  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
47891    composeDomainResourceElements(element);
47892    if (element.hasUrlElement()) {
47893      composeUriCore("url", element.getUrlElement(), false);
47894      composeUriExtras("url", element.getUrlElement(), false);
47895    }
47896    if (element.hasVersionElement()) {
47897      composeStringCore("version", element.getVersionElement(), false);
47898      composeStringExtras("version", element.getVersionElement(), false);
47899    }
47900    if (element.hasNameElement()) {
47901      composeStringCore("name", element.getNameElement(), false);
47902      composeStringExtras("name", element.getNameElement(), false);
47903    }
47904    if (element.hasStatusElement()) {
47905      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
47906          false);
47907      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
47908          false);
47909    }
47910    if (element.hasExperimentalElement()) {
47911      composeBooleanCore("experimental", element.getExperimentalElement(), false);
47912      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47913    }
47914    if (element.hasDateElement()) {
47915      composeDateTimeCore("date", element.getDateElement(), false);
47916      composeDateTimeExtras("date", element.getDateElement(), false);
47917    }
47918    if (element.hasPublisherElement()) {
47919      composeStringCore("publisher", element.getPublisherElement(), false);
47920      composeStringExtras("publisher", element.getPublisherElement(), false);
47921    }
47922    if (element.hasContact()) {
47923      openArray("contact");
47924      for (ContactDetail e : element.getContact())
47925        composeContactDetail(null, e);
47926      closeArray();
47927    }
47928    ;
47929    if (element.hasDescriptionElement()) {
47930      composeMarkdownCore("description", element.getDescriptionElement(), false);
47931      composeMarkdownExtras("description", element.getDescriptionElement(), false);
47932    }
47933    if (element.hasUseContext()) {
47934      openArray("useContext");
47935      for (UsageContext e : element.getUseContext())
47936        composeUsageContext(null, e);
47937      closeArray();
47938    }
47939    ;
47940    if (element.hasJurisdiction()) {
47941      openArray("jurisdiction");
47942      for (CodeableConcept e : element.getJurisdiction())
47943        composeCodeableConcept(null, e);
47944      closeArray();
47945    }
47946    ;
47947    if (element.hasPurposeElement()) {
47948      composeMarkdownCore("purpose", element.getPurposeElement(), false);
47949      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47950    }
47951    if (element.hasStartElement()) {
47952      composeCodeCore("start", element.getStartElement(), false);
47953      composeCodeExtras("start", element.getStartElement(), false);
47954    }
47955    if (element.hasProfileElement()) {
47956      composeCanonicalCore("profile", element.getProfileElement(), false);
47957      composeCanonicalExtras("profile", element.getProfileElement(), false);
47958    }
47959    if (element.hasLink()) {
47960      openArray("link");
47961      for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink())
47962        composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
47963      closeArray();
47964    }
47965    ;
47966  }
47967
47968  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name,
47969      GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
47970    if (element != null) {
47971      open(name);
47972      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
47973      close();
47974    }
47975  }
47976
47977  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(
47978      GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
47979    composeBackbone(element);
47980    if (element.hasPathElement()) {
47981      composeStringCore("path", element.getPathElement(), false);
47982      composeStringExtras("path", element.getPathElement(), false);
47983    }
47984    if (element.hasSliceNameElement()) {
47985      composeStringCore("sliceName", element.getSliceNameElement(), false);
47986      composeStringExtras("sliceName", element.getSliceNameElement(), false);
47987    }
47988    if (element.hasMinElement()) {
47989      composeIntegerCore("min", element.getMinElement(), false);
47990      composeIntegerExtras("min", element.getMinElement(), false);
47991    }
47992    if (element.hasMaxElement()) {
47993      composeStringCore("max", element.getMaxElement(), false);
47994      composeStringExtras("max", element.getMaxElement(), false);
47995    }
47996    if (element.hasDescriptionElement()) {
47997      composeStringCore("description", element.getDescriptionElement(), false);
47998      composeStringExtras("description", element.getDescriptionElement(), false);
47999    }
48000    if (element.hasTarget()) {
48001      openArray("target");
48002      for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget())
48003        composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
48004      closeArray();
48005    }
48006    ;
48007  }
48008
48009  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name,
48010      GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
48011    if (element != null) {
48012      open(name);
48013      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
48014      close();
48015    }
48016  }
48017
48018  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(
48019      GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
48020    composeBackbone(element);
48021    if (element.hasTypeElement()) {
48022      composeCodeCore("type", element.getTypeElement(), false);
48023      composeCodeExtras("type", element.getTypeElement(), false);
48024    }
48025    if (element.hasParamsElement()) {
48026      composeStringCore("params", element.getParamsElement(), false);
48027      composeStringExtras("params", element.getParamsElement(), false);
48028    }
48029    if (element.hasProfileElement()) {
48030      composeCanonicalCore("profile", element.getProfileElement(), false);
48031      composeCanonicalExtras("profile", element.getProfileElement(), false);
48032    }
48033    if (element.hasCompartment()) {
48034      openArray("compartment");
48035      for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment())
48036        composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
48037      closeArray();
48038    }
48039    ;
48040    if (element.hasLink()) {
48041      openArray("link");
48042      for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink())
48043        composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
48044      closeArray();
48045    }
48046    ;
48047  }
48048
48049  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name,
48050      GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
48051    if (element != null) {
48052      open(name);
48053      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
48054      close();
48055    }
48056  }
48057
48058  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(
48059      GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
48060    composeBackbone(element);
48061    if (element.hasUseElement()) {
48062      composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(),
48063          false);
48064      composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(),
48065          false);
48066    }
48067    if (element.hasCodeElement()) {
48068      composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
48069      composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(),
48070          false);
48071    }
48072    if (element.hasRuleElement()) {
48073      composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(),
48074          false);
48075      composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(),
48076          false);
48077    }
48078    if (element.hasExpressionElement()) {
48079      composeStringCore("expression", element.getExpressionElement(), false);
48080      composeStringExtras("expression", element.getExpressionElement(), false);
48081    }
48082    if (element.hasDescriptionElement()) {
48083      composeStringCore("description", element.getDescriptionElement(), false);
48084      composeStringExtras("description", element.getDescriptionElement(), false);
48085    }
48086  }
48087
48088  protected void composeGroup(String name, Group element) throws IOException {
48089    if (element != null) {
48090      prop("resourceType", name);
48091      composeGroupInner(element);
48092    }
48093  }
48094
48095  protected void composeGroupInner(Group element) throws IOException {
48096    composeDomainResourceElements(element);
48097    if (element.hasIdentifier()) {
48098      openArray("identifier");
48099      for (Identifier e : element.getIdentifier())
48100        composeIdentifier(null, e);
48101      closeArray();
48102    }
48103    ;
48104    if (element.hasActiveElement()) {
48105      composeBooleanCore("active", element.getActiveElement(), false);
48106      composeBooleanExtras("active", element.getActiveElement(), false);
48107    }
48108    if (element.hasTypeElement()) {
48109      composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
48110      composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
48111    }
48112    if (element.hasActualElement()) {
48113      composeBooleanCore("actual", element.getActualElement(), false);
48114      composeBooleanExtras("actual", element.getActualElement(), false);
48115    }
48116    if (element.hasCode()) {
48117      composeCodeableConcept("code", element.getCode());
48118    }
48119    if (element.hasNameElement()) {
48120      composeStringCore("name", element.getNameElement(), false);
48121      composeStringExtras("name", element.getNameElement(), false);
48122    }
48123    if (element.hasQuantityElement()) {
48124      composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
48125      composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
48126    }
48127    if (element.hasManagingEntity()) {
48128      composeReference("managingEntity", element.getManagingEntity());
48129    }
48130    if (element.hasCharacteristic()) {
48131      openArray("characteristic");
48132      for (Group.GroupCharacteristicComponent e : element.getCharacteristic())
48133        composeGroupGroupCharacteristicComponent(null, e);
48134      closeArray();
48135    }
48136    ;
48137    if (element.hasMember()) {
48138      openArray("member");
48139      for (Group.GroupMemberComponent e : element.getMember())
48140        composeGroupGroupMemberComponent(null, e);
48141      closeArray();
48142    }
48143    ;
48144  }
48145
48146  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element)
48147      throws IOException {
48148    if (element != null) {
48149      open(name);
48150      composeGroupGroupCharacteristicComponentInner(element);
48151      close();
48152    }
48153  }
48154
48155  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element)
48156      throws IOException {
48157    composeBackbone(element);
48158    if (element.hasCode()) {
48159      composeCodeableConcept("code", element.getCode());
48160    }
48161    if (element.hasValue()) {
48162      composeType("value", element.getValue());
48163    }
48164    if (element.hasExcludeElement()) {
48165      composeBooleanCore("exclude", element.getExcludeElement(), false);
48166      composeBooleanExtras("exclude", element.getExcludeElement(), false);
48167    }
48168    if (element.hasPeriod()) {
48169      composePeriod("period", element.getPeriod());
48170    }
48171  }
48172
48173  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
48174    if (element != null) {
48175      open(name);
48176      composeGroupGroupMemberComponentInner(element);
48177      close();
48178    }
48179  }
48180
48181  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
48182    composeBackbone(element);
48183    if (element.hasEntity()) {
48184      composeReference("entity", element.getEntity());
48185    }
48186    if (element.hasPeriod()) {
48187      composePeriod("period", element.getPeriod());
48188    }
48189    if (element.hasInactiveElement()) {
48190      composeBooleanCore("inactive", element.getInactiveElement(), false);
48191      composeBooleanExtras("inactive", element.getInactiveElement(), false);
48192    }
48193  }
48194
48195  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
48196    if (element != null) {
48197      prop("resourceType", name);
48198      composeGuidanceResponseInner(element);
48199    }
48200  }
48201
48202  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
48203    composeDomainResourceElements(element);
48204    if (element.hasRequestIdentifier()) {
48205      composeIdentifier("requestIdentifier", element.getRequestIdentifier());
48206    }
48207    if (element.hasIdentifier()) {
48208      openArray("identifier");
48209      for (Identifier e : element.getIdentifier())
48210        composeIdentifier(null, e);
48211      closeArray();
48212    }
48213    ;
48214    if (element.hasModule()) {
48215      composeType("module", element.getModule());
48216    }
48217    if (element.hasStatusElement()) {
48218      composeEnumerationCore("status", element.getStatusElement(),
48219          new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
48220      composeEnumerationExtras("status", element.getStatusElement(),
48221          new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
48222    }
48223    if (element.hasSubject()) {
48224      composeReference("subject", element.getSubject());
48225    }
48226    if (element.hasEncounter()) {
48227      composeReference("encounter", element.getEncounter());
48228    }
48229    if (element.hasOccurrenceDateTimeElement()) {
48230      composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
48231      composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
48232    }
48233    if (element.hasPerformer()) {
48234      composeReference("performer", element.getPerformer());
48235    }
48236    if (element.hasReasonCode()) {
48237      openArray("reasonCode");
48238      for (CodeableConcept e : element.getReasonCode())
48239        composeCodeableConcept(null, e);
48240      closeArray();
48241    }
48242    ;
48243    if (element.hasReasonReference()) {
48244      openArray("reasonReference");
48245      for (Reference e : element.getReasonReference())
48246        composeReference(null, e);
48247      closeArray();
48248    }
48249    ;
48250    if (element.hasNote()) {
48251      openArray("note");
48252      for (Annotation e : element.getNote())
48253        composeAnnotation(null, e);
48254      closeArray();
48255    }
48256    ;
48257    if (element.hasEvaluationMessage()) {
48258      openArray("evaluationMessage");
48259      for (Reference e : element.getEvaluationMessage())
48260        composeReference(null, e);
48261      closeArray();
48262    }
48263    ;
48264    if (element.hasOutputParameters()) {
48265      composeReference("outputParameters", element.getOutputParameters());
48266    }
48267    if (element.hasResult()) {
48268      composeReference("result", element.getResult());
48269    }
48270    if (element.hasDataRequirement()) {
48271      openArray("dataRequirement");
48272      for (DataRequirement e : element.getDataRequirement())
48273        composeDataRequirement(null, e);
48274      closeArray();
48275    }
48276    ;
48277  }
48278
48279  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
48280    if (element != null) {
48281      prop("resourceType", name);
48282      composeHealthcareServiceInner(element);
48283    }
48284  }
48285
48286  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
48287    composeDomainResourceElements(element);
48288    if (element.hasIdentifier()) {
48289      openArray("identifier");
48290      for (Identifier e : element.getIdentifier())
48291        composeIdentifier(null, e);
48292      closeArray();
48293    }
48294    ;
48295    if (element.hasActiveElement()) {
48296      composeBooleanCore("active", element.getActiveElement(), false);
48297      composeBooleanExtras("active", element.getActiveElement(), false);
48298    }
48299    if (element.hasProvidedBy()) {
48300      composeReference("providedBy", element.getProvidedBy());
48301    }
48302    if (element.hasCategory()) {
48303      openArray("category");
48304      for (CodeableConcept e : element.getCategory())
48305        composeCodeableConcept(null, e);
48306      closeArray();
48307    }
48308    ;
48309    if (element.hasType()) {
48310      openArray("type");
48311      for (CodeableConcept e : element.getType())
48312        composeCodeableConcept(null, e);
48313      closeArray();
48314    }
48315    ;
48316    if (element.hasSpecialty()) {
48317      openArray("specialty");
48318      for (CodeableConcept e : element.getSpecialty())
48319        composeCodeableConcept(null, e);
48320      closeArray();
48321    }
48322    ;
48323    if (element.hasLocation()) {
48324      openArray("location");
48325      for (Reference e : element.getLocation())
48326        composeReference(null, e);
48327      closeArray();
48328    }
48329    ;
48330    if (element.hasNameElement()) {
48331      composeStringCore("name", element.getNameElement(), false);
48332      composeStringExtras("name", element.getNameElement(), false);
48333    }
48334    if (element.hasCommentElement()) {
48335      composeStringCore("comment", element.getCommentElement(), false);
48336      composeStringExtras("comment", element.getCommentElement(), false);
48337    }
48338    if (element.hasExtraDetailsElement()) {
48339      composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
48340      composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
48341    }
48342    if (element.hasPhoto()) {
48343      composeAttachment("photo", element.getPhoto());
48344    }
48345    if (element.hasTelecom()) {
48346      openArray("telecom");
48347      for (ContactPoint e : element.getTelecom())
48348        composeContactPoint(null, e);
48349      closeArray();
48350    }
48351    ;
48352    if (element.hasCoverageArea()) {
48353      openArray("coverageArea");
48354      for (Reference e : element.getCoverageArea())
48355        composeReference(null, e);
48356      closeArray();
48357    }
48358    ;
48359    if (element.hasServiceProvisionCode()) {
48360      openArray("serviceProvisionCode");
48361      for (CodeableConcept e : element.getServiceProvisionCode())
48362        composeCodeableConcept(null, e);
48363      closeArray();
48364    }
48365    ;
48366    if (element.hasEligibility()) {
48367      openArray("eligibility");
48368      for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility())
48369        composeHealthcareServiceHealthcareServiceEligibilityComponent(null, e);
48370      closeArray();
48371    }
48372    ;
48373    if (element.hasProgram()) {
48374      openArray("program");
48375      for (CodeableConcept e : element.getProgram())
48376        composeCodeableConcept(null, e);
48377      closeArray();
48378    }
48379    ;
48380    if (element.hasCharacteristic()) {
48381      openArray("characteristic");
48382      for (CodeableConcept e : element.getCharacteristic())
48383        composeCodeableConcept(null, e);
48384      closeArray();
48385    }
48386    ;
48387    if (element.hasCommunication()) {
48388      openArray("communication");
48389      for (CodeableConcept e : element.getCommunication())
48390        composeCodeableConcept(null, e);
48391      closeArray();
48392    }
48393    ;
48394    if (element.hasReferralMethod()) {
48395      openArray("referralMethod");
48396      for (CodeableConcept e : element.getReferralMethod())
48397        composeCodeableConcept(null, e);
48398      closeArray();
48399    }
48400    ;
48401    if (element.hasAppointmentRequiredElement()) {
48402      composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
48403      composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
48404    }
48405    if (element.hasAvailableTime()) {
48406      openArray("availableTime");
48407      for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime())
48408        composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
48409      closeArray();
48410    }
48411    ;
48412    if (element.hasNotAvailable()) {
48413      openArray("notAvailable");
48414      for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable())
48415        composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
48416      closeArray();
48417    }
48418    ;
48419    if (element.hasAvailabilityExceptionsElement()) {
48420      composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
48421      composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
48422    }
48423    if (element.hasEndpoint()) {
48424      openArray("endpoint");
48425      for (Reference e : element.getEndpoint())
48426        composeReference(null, e);
48427      closeArray();
48428    }
48429    ;
48430  }
48431
48432  protected void composeHealthcareServiceHealthcareServiceEligibilityComponent(String name,
48433      HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
48434    if (element != null) {
48435      open(name);
48436      composeHealthcareServiceHealthcareServiceEligibilityComponentInner(element);
48437      close();
48438    }
48439  }
48440
48441  protected void composeHealthcareServiceHealthcareServiceEligibilityComponentInner(
48442      HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
48443    composeBackbone(element);
48444    if (element.hasCode()) {
48445      composeCodeableConcept("code", element.getCode());
48446    }
48447    if (element.hasCommentElement()) {
48448      composeMarkdownCore("comment", element.getCommentElement(), false);
48449      composeMarkdownExtras("comment", element.getCommentElement(), false);
48450    }
48451  }
48452
48453  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name,
48454      HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
48455    if (element != null) {
48456      open(name);
48457      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
48458      close();
48459    }
48460  }
48461
48462  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(
48463      HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
48464    composeBackbone(element);
48465    if (element.hasDaysOfWeek()) {
48466      openArray("daysOfWeek");
48467      for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek())
48468        composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
48469      closeArray();
48470      if (anyHasExtras(element.getDaysOfWeek())) {
48471        openArray("_daysOfWeek");
48472        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek())
48473          composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
48474        closeArray();
48475      }
48476    }
48477    ;
48478    if (element.hasAllDayElement()) {
48479      composeBooleanCore("allDay", element.getAllDayElement(), false);
48480      composeBooleanExtras("allDay", element.getAllDayElement(), false);
48481    }
48482    if (element.hasAvailableStartTimeElement()) {
48483      composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
48484      composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
48485    }
48486    if (element.hasAvailableEndTimeElement()) {
48487      composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
48488      composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
48489    }
48490  }
48491
48492  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name,
48493      HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
48494    if (element != null) {
48495      open(name);
48496      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
48497      close();
48498    }
48499  }
48500
48501  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(
48502      HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
48503    composeBackbone(element);
48504    if (element.hasDescriptionElement()) {
48505      composeStringCore("description", element.getDescriptionElement(), false);
48506      composeStringExtras("description", element.getDescriptionElement(), false);
48507    }
48508    if (element.hasDuring()) {
48509      composePeriod("during", element.getDuring());
48510    }
48511  }
48512
48513  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
48514    if (element != null) {
48515      prop("resourceType", name);
48516      composeImagingStudyInner(element);
48517    }
48518  }
48519
48520  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
48521    composeDomainResourceElements(element);
48522    if (element.hasIdentifier()) {
48523      openArray("identifier");
48524      for (Identifier e : element.getIdentifier())
48525        composeIdentifier(null, e);
48526      closeArray();
48527    }
48528    ;
48529    if (element.hasStatusElement()) {
48530      composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(),
48531          false);
48532      composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(),
48533          false);
48534    }
48535    if (element.hasModality()) {
48536      openArray("modality");
48537      for (Coding e : element.getModality())
48538        composeCoding(null, e);
48539      closeArray();
48540    }
48541    ;
48542    if (element.hasSubject()) {
48543      composeReference("subject", element.getSubject());
48544    }
48545    if (element.hasEncounter()) {
48546      composeReference("encounter", element.getEncounter());
48547    }
48548    if (element.hasStartedElement()) {
48549      composeDateTimeCore("started", element.getStartedElement(), false);
48550      composeDateTimeExtras("started", element.getStartedElement(), false);
48551    }
48552    if (element.hasBasedOn()) {
48553      openArray("basedOn");
48554      for (Reference e : element.getBasedOn())
48555        composeReference(null, e);
48556      closeArray();
48557    }
48558    ;
48559    if (element.hasReferrer()) {
48560      composeReference("referrer", element.getReferrer());
48561    }
48562    if (element.hasInterpreter()) {
48563      openArray("interpreter");
48564      for (Reference e : element.getInterpreter())
48565        composeReference(null, e);
48566      closeArray();
48567    }
48568    ;
48569    if (element.hasEndpoint()) {
48570      openArray("endpoint");
48571      for (Reference e : element.getEndpoint())
48572        composeReference(null, e);
48573      closeArray();
48574    }
48575    ;
48576    if (element.hasNumberOfSeriesElement()) {
48577      composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
48578      composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
48579    }
48580    if (element.hasNumberOfInstancesElement()) {
48581      composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
48582      composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
48583    }
48584    if (element.hasProcedureReference()) {
48585      composeReference("procedureReference", element.getProcedureReference());
48586    }
48587    if (element.hasProcedureCode()) {
48588      openArray("procedureCode");
48589      for (CodeableConcept e : element.getProcedureCode())
48590        composeCodeableConcept(null, e);
48591      closeArray();
48592    }
48593    ;
48594    if (element.hasLocation()) {
48595      composeReference("location", element.getLocation());
48596    }
48597    if (element.hasReasonCode()) {
48598      openArray("reasonCode");
48599      for (CodeableConcept e : element.getReasonCode())
48600        composeCodeableConcept(null, e);
48601      closeArray();
48602    }
48603    ;
48604    if (element.hasReasonReference()) {
48605      openArray("reasonReference");
48606      for (Reference e : element.getReasonReference())
48607        composeReference(null, e);
48608      closeArray();
48609    }
48610    ;
48611    if (element.hasNote()) {
48612      openArray("note");
48613      for (Annotation e : element.getNote())
48614        composeAnnotation(null, e);
48615      closeArray();
48616    }
48617    ;
48618    if (element.hasDescriptionElement()) {
48619      composeStringCore("description", element.getDescriptionElement(), false);
48620      composeStringExtras("description", element.getDescriptionElement(), false);
48621    }
48622    if (element.hasSeries()) {
48623      openArray("series");
48624      for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries())
48625        composeImagingStudyImagingStudySeriesComponent(null, e);
48626      closeArray();
48627    }
48628    ;
48629  }
48630
48631  protected void composeImagingStudyImagingStudySeriesComponent(String name,
48632      ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
48633    if (element != null) {
48634      open(name);
48635      composeImagingStudyImagingStudySeriesComponentInner(element);
48636      close();
48637    }
48638  }
48639
48640  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element)
48641      throws IOException {
48642    composeBackbone(element);
48643    if (element.hasUidElement()) {
48644      composeIdCore("uid", element.getUidElement(), false);
48645      composeIdExtras("uid", element.getUidElement(), false);
48646    }
48647    if (element.hasNumberElement()) {
48648      composeUnsignedIntCore("number", element.getNumberElement(), false);
48649      composeUnsignedIntExtras("number", element.getNumberElement(), false);
48650    }
48651    if (element.hasModality()) {
48652      composeCoding("modality", element.getModality());
48653    }
48654    if (element.hasDescriptionElement()) {
48655      composeStringCore("description", element.getDescriptionElement(), false);
48656      composeStringExtras("description", element.getDescriptionElement(), false);
48657    }
48658    if (element.hasNumberOfInstancesElement()) {
48659      composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
48660      composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
48661    }
48662    if (element.hasEndpoint()) {
48663      openArray("endpoint");
48664      for (Reference e : element.getEndpoint())
48665        composeReference(null, e);
48666      closeArray();
48667    }
48668    ;
48669    if (element.hasBodySite()) {
48670      composeCoding("bodySite", element.getBodySite());
48671    }
48672    if (element.hasLaterality()) {
48673      composeCoding("laterality", element.getLaterality());
48674    }
48675    if (element.hasSpecimen()) {
48676      openArray("specimen");
48677      for (Reference e : element.getSpecimen())
48678        composeReference(null, e);
48679      closeArray();
48680    }
48681    ;
48682    if (element.hasStartedElement()) {
48683      composeDateTimeCore("started", element.getStartedElement(), false);
48684      composeDateTimeExtras("started", element.getStartedElement(), false);
48685    }
48686    if (element.hasPerformer()) {
48687      openArray("performer");
48688      for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer())
48689        composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
48690      closeArray();
48691    }
48692    ;
48693    if (element.hasInstance()) {
48694      openArray("instance");
48695      for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance())
48696        composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
48697      closeArray();
48698    }
48699    ;
48700  }
48701
48702  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name,
48703      ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
48704    if (element != null) {
48705      open(name);
48706      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
48707      close();
48708    }
48709  }
48710
48711  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(
48712      ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
48713    composeBackbone(element);
48714    if (element.hasFunction()) {
48715      composeCodeableConcept("function", element.getFunction());
48716    }
48717    if (element.hasActor()) {
48718      composeReference("actor", element.getActor());
48719    }
48720  }
48721
48722  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name,
48723      ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
48724    if (element != null) {
48725      open(name);
48726      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
48727      close();
48728    }
48729  }
48730
48731  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(
48732      ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
48733    composeBackbone(element);
48734    if (element.hasUidElement()) {
48735      composeIdCore("uid", element.getUidElement(), false);
48736      composeIdExtras("uid", element.getUidElement(), false);
48737    }
48738    if (element.hasSopClass()) {
48739      composeCoding("sopClass", element.getSopClass());
48740    }
48741    if (element.hasNumberElement()) {
48742      composeUnsignedIntCore("number", element.getNumberElement(), false);
48743      composeUnsignedIntExtras("number", element.getNumberElement(), false);
48744    }
48745    if (element.hasTitleElement()) {
48746      composeStringCore("title", element.getTitleElement(), false);
48747      composeStringExtras("title", element.getTitleElement(), false);
48748    }
48749  }
48750
48751  protected void composeImmunization(String name, Immunization element) throws IOException {
48752    if (element != null) {
48753      prop("resourceType", name);
48754      composeImmunizationInner(element);
48755    }
48756  }
48757
48758  protected void composeImmunizationInner(Immunization element) throws IOException {
48759    composeDomainResourceElements(element);
48760    if (element.hasIdentifier()) {
48761      openArray("identifier");
48762      for (Identifier e : element.getIdentifier())
48763        composeIdentifier(null, e);
48764      closeArray();
48765    }
48766    ;
48767    if (element.hasStatusElement()) {
48768      composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(),
48769          false);
48770      composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(),
48771          false);
48772    }
48773    if (element.hasStatusReason()) {
48774      composeCodeableConcept("statusReason", element.getStatusReason());
48775    }
48776    if (element.hasVaccineCode()) {
48777      composeCodeableConcept("vaccineCode", element.getVaccineCode());
48778    }
48779    if (element.hasPatient()) {
48780      composeReference("patient", element.getPatient());
48781    }
48782    if (element.hasEncounter()) {
48783      composeReference("encounter", element.getEncounter());
48784    }
48785    if (element.hasOccurrence()) {
48786      composeType("occurrence", element.getOccurrence());
48787    }
48788    if (element.hasRecordedElement()) {
48789      composeDateTimeCore("recorded", element.getRecordedElement(), false);
48790      composeDateTimeExtras("recorded", element.getRecordedElement(), false);
48791    }
48792    if (element.hasPrimarySourceElement()) {
48793      composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
48794      composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
48795    }
48796    if (element.hasReportOrigin()) {
48797      composeCodeableConcept("reportOrigin", element.getReportOrigin());
48798    }
48799    if (element.hasLocation()) {
48800      composeReference("location", element.getLocation());
48801    }
48802    if (element.hasManufacturer()) {
48803      composeReference("manufacturer", element.getManufacturer());
48804    }
48805    if (element.hasLotNumberElement()) {
48806      composeStringCore("lotNumber", element.getLotNumberElement(), false);
48807      composeStringExtras("lotNumber", element.getLotNumberElement(), false);
48808    }
48809    if (element.hasExpirationDateElement()) {
48810      composeDateCore("expirationDate", element.getExpirationDateElement(), false);
48811      composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
48812    }
48813    if (element.hasSite()) {
48814      composeCodeableConcept("site", element.getSite());
48815    }
48816    if (element.hasRoute()) {
48817      composeCodeableConcept("route", element.getRoute());
48818    }
48819    if (element.hasDoseQuantity()) {
48820      composeQuantity("doseQuantity", element.getDoseQuantity());
48821    }
48822    if (element.hasPerformer()) {
48823      openArray("performer");
48824      for (Immunization.ImmunizationPerformerComponent e : element.getPerformer())
48825        composeImmunizationImmunizationPerformerComponent(null, e);
48826      closeArray();
48827    }
48828    ;
48829    if (element.hasNote()) {
48830      openArray("note");
48831      for (Annotation e : element.getNote())
48832        composeAnnotation(null, e);
48833      closeArray();
48834    }
48835    ;
48836    if (element.hasReasonCode()) {
48837      openArray("reasonCode");
48838      for (CodeableConcept e : element.getReasonCode())
48839        composeCodeableConcept(null, e);
48840      closeArray();
48841    }
48842    ;
48843    if (element.hasReasonReference()) {
48844      openArray("reasonReference");
48845      for (Reference e : element.getReasonReference())
48846        composeReference(null, e);
48847      closeArray();
48848    }
48849    ;
48850    if (element.hasIsSubpotentElement()) {
48851      composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
48852      composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
48853    }
48854    if (element.hasSubpotentReason()) {
48855      openArray("subpotentReason");
48856      for (CodeableConcept e : element.getSubpotentReason())
48857        composeCodeableConcept(null, e);
48858      closeArray();
48859    }
48860    ;
48861    if (element.hasEducation()) {
48862      openArray("education");
48863      for (Immunization.ImmunizationEducationComponent e : element.getEducation())
48864        composeImmunizationImmunizationEducationComponent(null, e);
48865      closeArray();
48866    }
48867    ;
48868    if (element.hasProgramEligibility()) {
48869      openArray("programEligibility");
48870      for (CodeableConcept e : element.getProgramEligibility())
48871        composeCodeableConcept(null, e);
48872      closeArray();
48873    }
48874    ;
48875    if (element.hasFundingSource()) {
48876      composeCodeableConcept("fundingSource", element.getFundingSource());
48877    }
48878    if (element.hasReaction()) {
48879      openArray("reaction");
48880      for (Immunization.ImmunizationReactionComponent e : element.getReaction())
48881        composeImmunizationImmunizationReactionComponent(null, e);
48882      closeArray();
48883    }
48884    ;
48885    if (element.hasProtocolApplied()) {
48886      openArray("protocolApplied");
48887      for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied())
48888        composeImmunizationImmunizationProtocolAppliedComponent(null, e);
48889      closeArray();
48890    }
48891    ;
48892  }
48893
48894  protected void composeImmunizationImmunizationPerformerComponent(String name,
48895      Immunization.ImmunizationPerformerComponent element) throws IOException {
48896    if (element != null) {
48897      open(name);
48898      composeImmunizationImmunizationPerformerComponentInner(element);
48899      close();
48900    }
48901  }
48902
48903  protected void composeImmunizationImmunizationPerformerComponentInner(
48904      Immunization.ImmunizationPerformerComponent element) throws IOException {
48905    composeBackbone(element);
48906    if (element.hasFunction()) {
48907      composeCodeableConcept("function", element.getFunction());
48908    }
48909    if (element.hasActor()) {
48910      composeReference("actor", element.getActor());
48911    }
48912  }
48913
48914  protected void composeImmunizationImmunizationEducationComponent(String name,
48915      Immunization.ImmunizationEducationComponent element) throws IOException {
48916    if (element != null) {
48917      open(name);
48918      composeImmunizationImmunizationEducationComponentInner(element);
48919      close();
48920    }
48921  }
48922
48923  protected void composeImmunizationImmunizationEducationComponentInner(
48924      Immunization.ImmunizationEducationComponent element) throws IOException {
48925    composeBackbone(element);
48926    if (element.hasDocumentTypeElement()) {
48927      composeStringCore("documentType", element.getDocumentTypeElement(), false);
48928      composeStringExtras("documentType", element.getDocumentTypeElement(), false);
48929    }
48930    if (element.hasReferenceElement()) {
48931      composeUriCore("reference", element.getReferenceElement(), false);
48932      composeUriExtras("reference", element.getReferenceElement(), false);
48933    }
48934    if (element.hasPublicationDateElement()) {
48935      composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
48936      composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
48937    }
48938    if (element.hasPresentationDateElement()) {
48939      composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
48940      composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
48941    }
48942  }
48943
48944  protected void composeImmunizationImmunizationReactionComponent(String name,
48945      Immunization.ImmunizationReactionComponent element) throws IOException {
48946    if (element != null) {
48947      open(name);
48948      composeImmunizationImmunizationReactionComponentInner(element);
48949      close();
48950    }
48951  }
48952
48953  protected void composeImmunizationImmunizationReactionComponentInner(
48954      Immunization.ImmunizationReactionComponent element) throws IOException {
48955    composeBackbone(element);
48956    if (element.hasDateElement()) {
48957      composeDateTimeCore("date", element.getDateElement(), false);
48958      composeDateTimeExtras("date", element.getDateElement(), false);
48959    }
48960    if (element.hasDetail()) {
48961      composeReference("detail", element.getDetail());
48962    }
48963    if (element.hasReportedElement()) {
48964      composeBooleanCore("reported", element.getReportedElement(), false);
48965      composeBooleanExtras("reported", element.getReportedElement(), false);
48966    }
48967  }
48968
48969  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name,
48970      Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
48971    if (element != null) {
48972      open(name);
48973      composeImmunizationImmunizationProtocolAppliedComponentInner(element);
48974      close();
48975    }
48976  }
48977
48978  protected void composeImmunizationImmunizationProtocolAppliedComponentInner(
48979      Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
48980    composeBackbone(element);
48981    if (element.hasSeriesElement()) {
48982      composeStringCore("series", element.getSeriesElement(), false);
48983      composeStringExtras("series", element.getSeriesElement(), false);
48984    }
48985    if (element.hasAuthority()) {
48986      composeReference("authority", element.getAuthority());
48987    }
48988    if (element.hasTargetDisease()) {
48989      openArray("targetDisease");
48990      for (CodeableConcept e : element.getTargetDisease())
48991        composeCodeableConcept(null, e);
48992      closeArray();
48993    }
48994    ;
48995    if (element.hasDoseNumber()) {
48996      composeType("doseNumber", element.getDoseNumber());
48997    }
48998    if (element.hasSeriesDoses()) {
48999      composeType("seriesDoses", element.getSeriesDoses());
49000    }
49001  }
49002
49003  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
49004    if (element != null) {
49005      prop("resourceType", name);
49006      composeImmunizationEvaluationInner(element);
49007    }
49008  }
49009
49010  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
49011    composeDomainResourceElements(element);
49012    if (element.hasIdentifier()) {
49013      openArray("identifier");
49014      for (Identifier e : element.getIdentifier())
49015        composeIdentifier(null, e);
49016      closeArray();
49017    }
49018    ;
49019    if (element.hasStatusElement()) {
49020      composeEnumerationCore("status", element.getStatusElement(),
49021          new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
49022      composeEnumerationExtras("status", element.getStatusElement(),
49023          new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
49024    }
49025    if (element.hasPatient()) {
49026      composeReference("patient", element.getPatient());
49027    }
49028    if (element.hasDateElement()) {
49029      composeDateTimeCore("date", element.getDateElement(), false);
49030      composeDateTimeExtras("date", element.getDateElement(), false);
49031    }
49032    if (element.hasAuthority()) {
49033      composeReference("authority", element.getAuthority());
49034    }
49035    if (element.hasTargetDisease()) {
49036      composeCodeableConcept("targetDisease", element.getTargetDisease());
49037    }
49038    if (element.hasImmunizationEvent()) {
49039      composeReference("immunizationEvent", element.getImmunizationEvent());
49040    }
49041    if (element.hasDoseStatus()) {
49042      composeCodeableConcept("doseStatus", element.getDoseStatus());
49043    }
49044    if (element.hasDoseStatusReason()) {
49045      openArray("doseStatusReason");
49046      for (CodeableConcept e : element.getDoseStatusReason())
49047        composeCodeableConcept(null, e);
49048      closeArray();
49049    }
49050    ;
49051    if (element.hasDescriptionElement()) {
49052      composeStringCore("description", element.getDescriptionElement(), false);
49053      composeStringExtras("description", element.getDescriptionElement(), false);
49054    }
49055    if (element.hasSeriesElement()) {
49056      composeStringCore("series", element.getSeriesElement(), false);
49057      composeStringExtras("series", element.getSeriesElement(), false);
49058    }
49059    if (element.hasDoseNumber()) {
49060      composeType("doseNumber", element.getDoseNumber());
49061    }
49062    if (element.hasSeriesDoses()) {
49063      composeType("seriesDoses", element.getSeriesDoses());
49064    }
49065  }
49066
49067  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
49068    if (element != null) {
49069      prop("resourceType", name);
49070      composeImmunizationRecommendationInner(element);
49071    }
49072  }
49073
49074  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
49075    composeDomainResourceElements(element);
49076    if (element.hasIdentifier()) {
49077      openArray("identifier");
49078      for (Identifier e : element.getIdentifier())
49079        composeIdentifier(null, e);
49080      closeArray();
49081    }
49082    ;
49083    if (element.hasPatient()) {
49084      composeReference("patient", element.getPatient());
49085    }
49086    if (element.hasDateElement()) {
49087      composeDateTimeCore("date", element.getDateElement(), false);
49088      composeDateTimeExtras("date", element.getDateElement(), false);
49089    }
49090    if (element.hasAuthority()) {
49091      composeReference("authority", element.getAuthority());
49092    }
49093    if (element.hasRecommendation()) {
49094      openArray("recommendation");
49095      for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation())
49096        composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
49097      closeArray();
49098    }
49099    ;
49100  }
49101
49102  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name,
49103      ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
49104    if (element != null) {
49105      open(name);
49106      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
49107      close();
49108    }
49109  }
49110
49111  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(
49112      ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
49113    composeBackbone(element);
49114    if (element.hasVaccineCode()) {
49115      openArray("vaccineCode");
49116      for (CodeableConcept e : element.getVaccineCode())
49117        composeCodeableConcept(null, e);
49118      closeArray();
49119    }
49120    ;
49121    if (element.hasTargetDisease()) {
49122      composeCodeableConcept("targetDisease", element.getTargetDisease());
49123    }
49124    if (element.hasContraindicatedVaccineCode()) {
49125      openArray("contraindicatedVaccineCode");
49126      for (CodeableConcept e : element.getContraindicatedVaccineCode())
49127        composeCodeableConcept(null, e);
49128      closeArray();
49129    }
49130    ;
49131    if (element.hasForecastStatus()) {
49132      composeCodeableConcept("forecastStatus", element.getForecastStatus());
49133    }
49134    if (element.hasForecastReason()) {
49135      openArray("forecastReason");
49136      for (CodeableConcept e : element.getForecastReason())
49137        composeCodeableConcept(null, e);
49138      closeArray();
49139    }
49140    ;
49141    if (element.hasDateCriterion()) {
49142      openArray("dateCriterion");
49143      for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element
49144          .getDateCriterion())
49145        composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
49146      closeArray();
49147    }
49148    ;
49149    if (element.hasDescriptionElement()) {
49150      composeStringCore("description", element.getDescriptionElement(), false);
49151      composeStringExtras("description", element.getDescriptionElement(), false);
49152    }
49153    if (element.hasSeriesElement()) {
49154      composeStringCore("series", element.getSeriesElement(), false);
49155      composeStringExtras("series", element.getSeriesElement(), false);
49156    }
49157    if (element.hasDoseNumber()) {
49158      composeType("doseNumber", element.getDoseNumber());
49159    }
49160    if (element.hasSeriesDoses()) {
49161      composeType("seriesDoses", element.getSeriesDoses());
49162    }
49163    if (element.hasSupportingImmunization()) {
49164      openArray("supportingImmunization");
49165      for (Reference e : element.getSupportingImmunization())
49166        composeReference(null, e);
49167      closeArray();
49168    }
49169    ;
49170    if (element.hasSupportingPatientInformation()) {
49171      openArray("supportingPatientInformation");
49172      for (Reference e : element.getSupportingPatientInformation())
49173        composeReference(null, e);
49174      closeArray();
49175    }
49176    ;
49177  }
49178
49179  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(
49180      String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element)
49181      throws IOException {
49182    if (element != null) {
49183      open(name);
49184      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
49185      close();
49186    }
49187  }
49188
49189  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(
49190      ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element)
49191      throws IOException {
49192    composeBackbone(element);
49193    if (element.hasCode()) {
49194      composeCodeableConcept("code", element.getCode());
49195    }
49196    if (element.hasValueElement()) {
49197      composeDateTimeCore("value", element.getValueElement(), false);
49198      composeDateTimeExtras("value", element.getValueElement(), false);
49199    }
49200  }
49201
49202  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
49203    if (element != null) {
49204      prop("resourceType", name);
49205      composeImplementationGuideInner(element);
49206    }
49207  }
49208
49209  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
49210    composeDomainResourceElements(element);
49211    if (element.hasUrlElement()) {
49212      composeUriCore("url", element.getUrlElement(), false);
49213      composeUriExtras("url", element.getUrlElement(), false);
49214    }
49215    if (element.hasVersionElement()) {
49216      composeStringCore("version", element.getVersionElement(), false);
49217      composeStringExtras("version", element.getVersionElement(), false);
49218    }
49219    if (element.hasNameElement()) {
49220      composeStringCore("name", element.getNameElement(), false);
49221      composeStringExtras("name", element.getNameElement(), false);
49222    }
49223    if (element.hasTitleElement()) {
49224      composeStringCore("title", element.getTitleElement(), false);
49225      composeStringExtras("title", element.getTitleElement(), false);
49226    }
49227    if (element.hasStatusElement()) {
49228      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
49229          false);
49230      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
49231          false);
49232    }
49233    if (element.hasExperimentalElement()) {
49234      composeBooleanCore("experimental", element.getExperimentalElement(), false);
49235      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49236    }
49237    if (element.hasDateElement()) {
49238      composeDateTimeCore("date", element.getDateElement(), false);
49239      composeDateTimeExtras("date", element.getDateElement(), false);
49240    }
49241    if (element.hasPublisherElement()) {
49242      composeStringCore("publisher", element.getPublisherElement(), false);
49243      composeStringExtras("publisher", element.getPublisherElement(), false);
49244    }
49245    if (element.hasContact()) {
49246      openArray("contact");
49247      for (ContactDetail e : element.getContact())
49248        composeContactDetail(null, e);
49249      closeArray();
49250    }
49251    ;
49252    if (element.hasDescriptionElement()) {
49253      composeMarkdownCore("description", element.getDescriptionElement(), false);
49254      composeMarkdownExtras("description", element.getDescriptionElement(), false);
49255    }
49256    if (element.hasUseContext()) {
49257      openArray("useContext");
49258      for (UsageContext e : element.getUseContext())
49259        composeUsageContext(null, e);
49260      closeArray();
49261    }
49262    ;
49263    if (element.hasJurisdiction()) {
49264      openArray("jurisdiction");
49265      for (CodeableConcept e : element.getJurisdiction())
49266        composeCodeableConcept(null, e);
49267      closeArray();
49268    }
49269    ;
49270    if (element.hasCopyrightElement()) {
49271      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
49272      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
49273    }
49274    if (element.hasPackageIdElement()) {
49275      composeIdCore("packageId", element.getPackageIdElement(), false);
49276      composeIdExtras("packageId", element.getPackageIdElement(), false);
49277    }
49278    if (element.hasLicenseElement()) {
49279      composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(),
49280          false);
49281      composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(),
49282          false);
49283    }
49284    if (element.hasFhirVersion()) {
49285      openArray("fhirVersion");
49286      for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion())
49287        composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
49288      closeArray();
49289      if (anyHasExtras(element.getFhirVersion())) {
49290        openArray("_fhirVersion");
49291        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion())
49292          composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
49293        closeArray();
49294      }
49295    }
49296    ;
49297    if (element.hasDependsOn()) {
49298      openArray("dependsOn");
49299      for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn())
49300        composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
49301      closeArray();
49302    }
49303    ;
49304    if (element.hasGlobal()) {
49305      openArray("global");
49306      for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal())
49307        composeImplementationGuideImplementationGuideGlobalComponent(null, e);
49308      closeArray();
49309    }
49310    ;
49311    if (element.hasDefinition()) {
49312      composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
49313    }
49314    if (element.hasManifest()) {
49315      composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
49316    }
49317  }
49318
49319  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name,
49320      ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
49321    if (element != null) {
49322      open(name);
49323      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
49324      close();
49325    }
49326  }
49327
49328  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(
49329      ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
49330    composeBackbone(element);
49331    if (element.hasUriElement()) {
49332      composeCanonicalCore("uri", element.getUriElement(), false);
49333      composeCanonicalExtras("uri", element.getUriElement(), false);
49334    }
49335    if (element.hasPackageIdElement()) {
49336      composeIdCore("packageId", element.getPackageIdElement(), false);
49337      composeIdExtras("packageId", element.getPackageIdElement(), false);
49338    }
49339    if (element.hasVersionElement()) {
49340      composeStringCore("version", element.getVersionElement(), false);
49341      composeStringExtras("version", element.getVersionElement(), false);
49342    }
49343  }
49344
49345  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name,
49346      ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
49347    if (element != null) {
49348      open(name);
49349      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
49350      close();
49351    }
49352  }
49353
49354  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(
49355      ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
49356    composeBackbone(element);
49357    if (element.hasTypeElement()) {
49358      composeCodeCore("type", element.getTypeElement(), false);
49359      composeCodeExtras("type", element.getTypeElement(), false);
49360    }
49361    if (element.hasProfileElement()) {
49362      composeCanonicalCore("profile", element.getProfileElement(), false);
49363      composeCanonicalExtras("profile", element.getProfileElement(), false);
49364    }
49365  }
49366
49367  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name,
49368      ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
49369    if (element != null) {
49370      open(name);
49371      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
49372      close();
49373    }
49374  }
49375
49376  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(
49377      ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
49378    composeBackbone(element);
49379    if (element.hasGrouping()) {
49380      openArray("grouping");
49381      for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping())
49382        composeImplementationGuideImplementationGuideDefinitionGroupingComponent(null, e);
49383      closeArray();
49384    }
49385    ;
49386    if (element.hasResource()) {
49387      openArray("resource");
49388      for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource())
49389        composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
49390      closeArray();
49391    }
49392    ;
49393    if (element.hasPage()) {
49394      composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
49395    }
49396    if (element.hasParameter()) {
49397      openArray("parameter");
49398      for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter())
49399        composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
49400      closeArray();
49401    }
49402    ;
49403    if (element.hasTemplate()) {
49404      openArray("template");
49405      for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate())
49406        composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
49407      closeArray();
49408    }
49409    ;
49410  }
49411
49412  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponent(String name,
49413      ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
49414    if (element != null) {
49415      open(name);
49416      composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(element);
49417      close();
49418    }
49419  }
49420
49421  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(
49422      ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
49423    composeBackbone(element);
49424    if (element.hasNameElement()) {
49425      composeStringCore("name", element.getNameElement(), false);
49426      composeStringExtras("name", element.getNameElement(), false);
49427    }
49428    if (element.hasDescriptionElement()) {
49429      composeStringCore("description", element.getDescriptionElement(), false);
49430      composeStringExtras("description", element.getDescriptionElement(), false);
49431    }
49432  }
49433
49434  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name,
49435      ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
49436    if (element != null) {
49437      open(name);
49438      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
49439      close();
49440    }
49441  }
49442
49443  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(
49444      ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
49445    composeBackbone(element);
49446    if (element.hasReference()) {
49447      composeReference("reference", element.getReference());
49448    }
49449    if (element.hasFhirVersion()) {
49450      openArray("fhirVersion");
49451      for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion())
49452        composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
49453      closeArray();
49454      if (anyHasExtras(element.getFhirVersion())) {
49455        openArray("_fhirVersion");
49456        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion())
49457          composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
49458        closeArray();
49459      }
49460    }
49461    ;
49462    if (element.hasNameElement()) {
49463      composeStringCore("name", element.getNameElement(), false);
49464      composeStringExtras("name", element.getNameElement(), false);
49465    }
49466    if (element.hasDescriptionElement()) {
49467      composeStringCore("description", element.getDescriptionElement(), false);
49468      composeStringExtras("description", element.getDescriptionElement(), false);
49469    }
49470    if (element.hasExample()) {
49471      composeType("example", element.getExample());
49472    }
49473    if (element.hasGroupingIdElement()) {
49474      composeIdCore("groupingId", element.getGroupingIdElement(), false);
49475      composeIdExtras("groupingId", element.getGroupingIdElement(), false);
49476    }
49477  }
49478
49479  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name,
49480      ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
49481    if (element != null) {
49482      open(name);
49483      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
49484      close();
49485    }
49486  }
49487
49488  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(
49489      ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
49490    composeBackbone(element);
49491    if (element.hasName()) {
49492      composeType("name", element.getName());
49493    }
49494    if (element.hasTitleElement()) {
49495      composeStringCore("title", element.getTitleElement(), false);
49496      composeStringExtras("title", element.getTitleElement(), false);
49497    }
49498    if (element.hasGenerationElement()) {
49499      composeEnumerationCore("generation", element.getGenerationElement(),
49500          new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
49501      composeEnumerationExtras("generation", element.getGenerationElement(),
49502          new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
49503    }
49504    if (element.hasPage()) {
49505      openArray("page");
49506      for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage())
49507        composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
49508      closeArray();
49509    }
49510    ;
49511  }
49512
49513  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name,
49514      ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
49515    if (element != null) {
49516      open(name);
49517      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
49518      close();
49519    }
49520  }
49521
49522  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(
49523      ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
49524    composeBackbone(element);
49525    if (element.hasCodeElement()) {
49526      composeStringCore("code", element.getCodeElement(), false);
49527      composeStringExtras("code", element.getCodeElement(), false);
49528    }
49529    if (element.hasValueElement()) {
49530      composeStringCore("value", element.getValueElement(), false);
49531      composeStringExtras("value", element.getValueElement(), false);
49532    }
49533  }
49534
49535  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name,
49536      ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
49537    if (element != null) {
49538      open(name);
49539      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
49540      close();
49541    }
49542  }
49543
49544  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(
49545      ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
49546    composeBackbone(element);
49547    if (element.hasCodeElement()) {
49548      composeCodeCore("code", element.getCodeElement(), false);
49549      composeCodeExtras("code", element.getCodeElement(), false);
49550    }
49551    if (element.hasSourceElement()) {
49552      composeStringCore("source", element.getSourceElement(), false);
49553      composeStringExtras("source", element.getSourceElement(), false);
49554    }
49555    if (element.hasScopeElement()) {
49556      composeStringCore("scope", element.getScopeElement(), false);
49557      composeStringExtras("scope", element.getScopeElement(), false);
49558    }
49559  }
49560
49561  protected void composeImplementationGuideImplementationGuideManifestComponent(String name,
49562      ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
49563    if (element != null) {
49564      open(name);
49565      composeImplementationGuideImplementationGuideManifestComponentInner(element);
49566      close();
49567    }
49568  }
49569
49570  protected void composeImplementationGuideImplementationGuideManifestComponentInner(
49571      ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
49572    composeBackbone(element);
49573    if (element.hasRenderingElement()) {
49574      composeUrlCore("rendering", element.getRenderingElement(), false);
49575      composeUrlExtras("rendering", element.getRenderingElement(), false);
49576    }
49577    if (element.hasResource()) {
49578      openArray("resource");
49579      for (ImplementationGuide.ManifestResourceComponent e : element.getResource())
49580        composeImplementationGuideManifestResourceComponent(null, e);
49581      closeArray();
49582    }
49583    ;
49584    if (element.hasPage()) {
49585      openArray("page");
49586      for (ImplementationGuide.ManifestPageComponent e : element.getPage())
49587        composeImplementationGuideManifestPageComponent(null, e);
49588      closeArray();
49589    }
49590    ;
49591    if (element.hasImage()) {
49592      openArray("image");
49593      for (StringType e : element.getImage())
49594        composeStringCore(null, e, true);
49595      closeArray();
49596      if (anyHasExtras(element.getImage())) {
49597        openArray("_image");
49598        for (StringType e : element.getImage())
49599          composeStringExtras(null, e, true);
49600        closeArray();
49601      }
49602    }
49603    ;
49604    if (element.hasOther()) {
49605      openArray("other");
49606      for (StringType e : element.getOther())
49607        composeStringCore(null, e, true);
49608      closeArray();
49609      if (anyHasExtras(element.getOther())) {
49610        openArray("_other");
49611        for (StringType e : element.getOther())
49612          composeStringExtras(null, e, true);
49613        closeArray();
49614      }
49615    }
49616    ;
49617  }
49618
49619  protected void composeImplementationGuideManifestResourceComponent(String name,
49620      ImplementationGuide.ManifestResourceComponent element) throws IOException {
49621    if (element != null) {
49622      open(name);
49623      composeImplementationGuideManifestResourceComponentInner(element);
49624      close();
49625    }
49626  }
49627
49628  protected void composeImplementationGuideManifestResourceComponentInner(
49629      ImplementationGuide.ManifestResourceComponent element) throws IOException {
49630    composeBackbone(element);
49631    if (element.hasReference()) {
49632      composeReference("reference", element.getReference());
49633    }
49634    if (element.hasExample()) {
49635      composeType("example", element.getExample());
49636    }
49637    if (element.hasRelativePathElement()) {
49638      composeUrlCore("relativePath", element.getRelativePathElement(), false);
49639      composeUrlExtras("relativePath", element.getRelativePathElement(), false);
49640    }
49641  }
49642
49643  protected void composeImplementationGuideManifestPageComponent(String name,
49644      ImplementationGuide.ManifestPageComponent element) throws IOException {
49645    if (element != null) {
49646      open(name);
49647      composeImplementationGuideManifestPageComponentInner(element);
49648      close();
49649    }
49650  }
49651
49652  protected void composeImplementationGuideManifestPageComponentInner(ImplementationGuide.ManifestPageComponent element)
49653      throws IOException {
49654    composeBackbone(element);
49655    if (element.hasNameElement()) {
49656      composeStringCore("name", element.getNameElement(), false);
49657      composeStringExtras("name", element.getNameElement(), false);
49658    }
49659    if (element.hasTitleElement()) {
49660      composeStringCore("title", element.getTitleElement(), false);
49661      composeStringExtras("title", element.getTitleElement(), false);
49662    }
49663    if (element.hasAnchor()) {
49664      openArray("anchor");
49665      for (StringType e : element.getAnchor())
49666        composeStringCore(null, e, true);
49667      closeArray();
49668      if (anyHasExtras(element.getAnchor())) {
49669        openArray("_anchor");
49670        for (StringType e : element.getAnchor())
49671          composeStringExtras(null, e, true);
49672        closeArray();
49673      }
49674    }
49675    ;
49676  }
49677
49678  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
49679    if (element != null) {
49680      prop("resourceType", name);
49681      composeInsurancePlanInner(element);
49682    }
49683  }
49684
49685  protected void composeInsurancePlanInner(InsurancePlan element) throws IOException {
49686    composeDomainResourceElements(element);
49687    if (element.hasIdentifier()) {
49688      openArray("identifier");
49689      for (Identifier e : element.getIdentifier())
49690        composeIdentifier(null, e);
49691      closeArray();
49692    }
49693    ;
49694    if (element.hasStatusElement()) {
49695      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
49696          false);
49697      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
49698          false);
49699    }
49700    if (element.hasType()) {
49701      openArray("type");
49702      for (CodeableConcept e : element.getType())
49703        composeCodeableConcept(null, e);
49704      closeArray();
49705    }
49706    ;
49707    if (element.hasNameElement()) {
49708      composeStringCore("name", element.getNameElement(), false);
49709      composeStringExtras("name", element.getNameElement(), false);
49710    }
49711    if (element.hasAlias()) {
49712      openArray("alias");
49713      for (StringType e : element.getAlias())
49714        composeStringCore(null, e, true);
49715      closeArray();
49716      if (anyHasExtras(element.getAlias())) {
49717        openArray("_alias");
49718        for (StringType e : element.getAlias())
49719          composeStringExtras(null, e, true);
49720        closeArray();
49721      }
49722    }
49723    ;
49724    if (element.hasPeriod()) {
49725      composePeriod("period", element.getPeriod());
49726    }
49727    if (element.hasOwnedBy()) {
49728      composeReference("ownedBy", element.getOwnedBy());
49729    }
49730    if (element.hasAdministeredBy()) {
49731      composeReference("administeredBy", element.getAdministeredBy());
49732    }
49733    if (element.hasCoverageArea()) {
49734      openArray("coverageArea");
49735      for (Reference e : element.getCoverageArea())
49736        composeReference(null, e);
49737      closeArray();
49738    }
49739    ;
49740    if (element.hasContact()) {
49741      openArray("contact");
49742      for (InsurancePlan.InsurancePlanContactComponent e : element.getContact())
49743        composeInsurancePlanInsurancePlanContactComponent(null, e);
49744      closeArray();
49745    }
49746    ;
49747    if (element.hasEndpoint()) {
49748      openArray("endpoint");
49749      for (Reference e : element.getEndpoint())
49750        composeReference(null, e);
49751      closeArray();
49752    }
49753    ;
49754    if (element.hasNetwork()) {
49755      openArray("network");
49756      for (Reference e : element.getNetwork())
49757        composeReference(null, e);
49758      closeArray();
49759    }
49760    ;
49761    if (element.hasCoverage()) {
49762      openArray("coverage");
49763      for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage())
49764        composeInsurancePlanInsurancePlanCoverageComponent(null, e);
49765      closeArray();
49766    }
49767    ;
49768    if (element.hasPlan()) {
49769      openArray("plan");
49770      for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan())
49771        composeInsurancePlanInsurancePlanPlanComponent(null, e);
49772      closeArray();
49773    }
49774    ;
49775  }
49776
49777  protected void composeInsurancePlanInsurancePlanContactComponent(String name,
49778      InsurancePlan.InsurancePlanContactComponent element) throws IOException {
49779    if (element != null) {
49780      open(name);
49781      composeInsurancePlanInsurancePlanContactComponentInner(element);
49782      close();
49783    }
49784  }
49785
49786  protected void composeInsurancePlanInsurancePlanContactComponentInner(
49787      InsurancePlan.InsurancePlanContactComponent element) throws IOException {
49788    composeBackbone(element);
49789    if (element.hasPurpose()) {
49790      composeCodeableConcept("purpose", element.getPurpose());
49791    }
49792    if (element.hasName()) {
49793      composeHumanName("name", element.getName());
49794    }
49795    if (element.hasTelecom()) {
49796      openArray("telecom");
49797      for (ContactPoint e : element.getTelecom())
49798        composeContactPoint(null, e);
49799      closeArray();
49800    }
49801    ;
49802    if (element.hasAddress()) {
49803      composeAddress("address", element.getAddress());
49804    }
49805  }
49806
49807  protected void composeInsurancePlanInsurancePlanCoverageComponent(String name,
49808      InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
49809    if (element != null) {
49810      open(name);
49811      composeInsurancePlanInsurancePlanCoverageComponentInner(element);
49812      close();
49813    }
49814  }
49815
49816  protected void composeInsurancePlanInsurancePlanCoverageComponentInner(
49817      InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
49818    composeBackbone(element);
49819    if (element.hasType()) {
49820      composeCodeableConcept("type", element.getType());
49821    }
49822    if (element.hasNetwork()) {
49823      openArray("network");
49824      for (Reference e : element.getNetwork())
49825        composeReference(null, e);
49826      closeArray();
49827    }
49828    ;
49829    if (element.hasBenefit()) {
49830      openArray("benefit");
49831      for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit())
49832        composeInsurancePlanCoverageBenefitComponent(null, e);
49833      closeArray();
49834    }
49835    ;
49836  }
49837
49838  protected void composeInsurancePlanCoverageBenefitComponent(String name,
49839      InsurancePlan.CoverageBenefitComponent element) throws IOException {
49840    if (element != null) {
49841      open(name);
49842      composeInsurancePlanCoverageBenefitComponentInner(element);
49843      close();
49844    }
49845  }
49846
49847  protected void composeInsurancePlanCoverageBenefitComponentInner(InsurancePlan.CoverageBenefitComponent element)
49848      throws IOException {
49849    composeBackbone(element);
49850    if (element.hasType()) {
49851      composeCodeableConcept("type", element.getType());
49852    }
49853    if (element.hasRequirementElement()) {
49854      composeStringCore("requirement", element.getRequirementElement(), false);
49855      composeStringExtras("requirement", element.getRequirementElement(), false);
49856    }
49857    if (element.hasLimit()) {
49858      openArray("limit");
49859      for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit())
49860        composeInsurancePlanCoverageBenefitLimitComponent(null, e);
49861      closeArray();
49862    }
49863    ;
49864  }
49865
49866  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name,
49867      InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
49868    if (element != null) {
49869      open(name);
49870      composeInsurancePlanCoverageBenefitLimitComponentInner(element);
49871      close();
49872    }
49873  }
49874
49875  protected void composeInsurancePlanCoverageBenefitLimitComponentInner(
49876      InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
49877    composeBackbone(element);
49878    if (element.hasValue()) {
49879      composeQuantity("value", element.getValue());
49880    }
49881    if (element.hasCode()) {
49882      composeCodeableConcept("code", element.getCode());
49883    }
49884  }
49885
49886  protected void composeInsurancePlanInsurancePlanPlanComponent(String name,
49887      InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
49888    if (element != null) {
49889      open(name);
49890      composeInsurancePlanInsurancePlanPlanComponentInner(element);
49891      close();
49892    }
49893  }
49894
49895  protected void composeInsurancePlanInsurancePlanPlanComponentInner(InsurancePlan.InsurancePlanPlanComponent element)
49896      throws IOException {
49897    composeBackbone(element);
49898    if (element.hasIdentifier()) {
49899      openArray("identifier");
49900      for (Identifier e : element.getIdentifier())
49901        composeIdentifier(null, e);
49902      closeArray();
49903    }
49904    ;
49905    if (element.hasType()) {
49906      composeCodeableConcept("type", element.getType());
49907    }
49908    if (element.hasCoverageArea()) {
49909      openArray("coverageArea");
49910      for (Reference e : element.getCoverageArea())
49911        composeReference(null, e);
49912      closeArray();
49913    }
49914    ;
49915    if (element.hasNetwork()) {
49916      openArray("network");
49917      for (Reference e : element.getNetwork())
49918        composeReference(null, e);
49919      closeArray();
49920    }
49921    ;
49922    if (element.hasGeneralCost()) {
49923      openArray("generalCost");
49924      for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost())
49925        composeInsurancePlanInsurancePlanPlanGeneralCostComponent(null, e);
49926      closeArray();
49927    }
49928    ;
49929    if (element.hasSpecificCost()) {
49930      openArray("specificCost");
49931      for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost())
49932        composeInsurancePlanInsurancePlanPlanSpecificCostComponent(null, e);
49933      closeArray();
49934    }
49935    ;
49936  }
49937
49938  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name,
49939      InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
49940    if (element != null) {
49941      open(name);
49942      composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(element);
49943      close();
49944    }
49945  }
49946
49947  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(
49948      InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
49949    composeBackbone(element);
49950    if (element.hasType()) {
49951      composeCodeableConcept("type", element.getType());
49952    }
49953    if (element.hasGroupSizeElement()) {
49954      composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
49955      composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
49956    }
49957    if (element.hasCost()) {
49958      composeMoney("cost", element.getCost());
49959    }
49960    if (element.hasCommentElement()) {
49961      composeStringCore("comment", element.getCommentElement(), false);
49962      composeStringExtras("comment", element.getCommentElement(), false);
49963    }
49964  }
49965
49966  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name,
49967      InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
49968    if (element != null) {
49969      open(name);
49970      composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(element);
49971      close();
49972    }
49973  }
49974
49975  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(
49976      InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
49977    composeBackbone(element);
49978    if (element.hasCategory()) {
49979      composeCodeableConcept("category", element.getCategory());
49980    }
49981    if (element.hasBenefit()) {
49982      openArray("benefit");
49983      for (InsurancePlan.PlanBenefitComponent e : element.getBenefit())
49984        composeInsurancePlanPlanBenefitComponent(null, e);
49985      closeArray();
49986    }
49987    ;
49988  }
49989
49990  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element)
49991      throws IOException {
49992    if (element != null) {
49993      open(name);
49994      composeInsurancePlanPlanBenefitComponentInner(element);
49995      close();
49996    }
49997  }
49998
49999  protected void composeInsurancePlanPlanBenefitComponentInner(InsurancePlan.PlanBenefitComponent element)
50000      throws IOException {
50001    composeBackbone(element);
50002    if (element.hasType()) {
50003      composeCodeableConcept("type", element.getType());
50004    }
50005    if (element.hasCost()) {
50006      openArray("cost");
50007      for (InsurancePlan.PlanBenefitCostComponent e : element.getCost())
50008        composeInsurancePlanPlanBenefitCostComponent(null, e);
50009      closeArray();
50010    }
50011    ;
50012  }
50013
50014  protected void composeInsurancePlanPlanBenefitCostComponent(String name,
50015      InsurancePlan.PlanBenefitCostComponent element) throws IOException {
50016    if (element != null) {
50017      open(name);
50018      composeInsurancePlanPlanBenefitCostComponentInner(element);
50019      close();
50020    }
50021  }
50022
50023  protected void composeInsurancePlanPlanBenefitCostComponentInner(InsurancePlan.PlanBenefitCostComponent element)
50024      throws IOException {
50025    composeBackbone(element);
50026    if (element.hasType()) {
50027      composeCodeableConcept("type", element.getType());
50028    }
50029    if (element.hasApplicability()) {
50030      composeCodeableConcept("applicability", element.getApplicability());
50031    }
50032    if (element.hasQualifiers()) {
50033      openArray("qualifiers");
50034      for (CodeableConcept e : element.getQualifiers())
50035        composeCodeableConcept(null, e);
50036      closeArray();
50037    }
50038    ;
50039    if (element.hasValue()) {
50040      composeQuantity("value", element.getValue());
50041    }
50042  }
50043
50044  protected void composeInvoice(String name, Invoice element) throws IOException {
50045    if (element != null) {
50046      prop("resourceType", name);
50047      composeInvoiceInner(element);
50048    }
50049  }
50050
50051  protected void composeInvoiceInner(Invoice element) throws IOException {
50052    composeDomainResourceElements(element);
50053    if (element.hasIdentifier()) {
50054      openArray("identifier");
50055      for (Identifier e : element.getIdentifier())
50056        composeIdentifier(null, e);
50057      closeArray();
50058    }
50059    ;
50060    if (element.hasStatusElement()) {
50061      composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
50062      composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
50063    }
50064    if (element.hasCancelledReasonElement()) {
50065      composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
50066      composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
50067    }
50068    if (element.hasType()) {
50069      composeCodeableConcept("type", element.getType());
50070    }
50071    if (element.hasSubject()) {
50072      composeReference("subject", element.getSubject());
50073    }
50074    if (element.hasRecipient()) {
50075      composeReference("recipient", element.getRecipient());
50076    }
50077    if (element.hasDateElement()) {
50078      composeDateTimeCore("date", element.getDateElement(), false);
50079      composeDateTimeExtras("date", element.getDateElement(), false);
50080    }
50081    if (element.hasParticipant()) {
50082      openArray("participant");
50083      for (Invoice.InvoiceParticipantComponent e : element.getParticipant())
50084        composeInvoiceInvoiceParticipantComponent(null, e);
50085      closeArray();
50086    }
50087    ;
50088    if (element.hasIssuer()) {
50089      composeReference("issuer", element.getIssuer());
50090    }
50091    if (element.hasAccount()) {
50092      composeReference("account", element.getAccount());
50093    }
50094    if (element.hasLineItem()) {
50095      openArray("lineItem");
50096      for (Invoice.InvoiceLineItemComponent e : element.getLineItem())
50097        composeInvoiceInvoiceLineItemComponent(null, e);
50098      closeArray();
50099    }
50100    ;
50101    if (element.hasTotalPriceComponent()) {
50102      openArray("totalPriceComponent");
50103      for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent())
50104        composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
50105      closeArray();
50106    }
50107    ;
50108    if (element.hasTotalNet()) {
50109      composeMoney("totalNet", element.getTotalNet());
50110    }
50111    if (element.hasTotalGross()) {
50112      composeMoney("totalGross", element.getTotalGross());
50113    }
50114    if (element.hasPaymentTermsElement()) {
50115      composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
50116      composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
50117    }
50118    if (element.hasNote()) {
50119      openArray("note");
50120      for (Annotation e : element.getNote())
50121        composeAnnotation(null, e);
50122      closeArray();
50123    }
50124    ;
50125  }
50126
50127  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element)
50128      throws IOException {
50129    if (element != null) {
50130      open(name);
50131      composeInvoiceInvoiceParticipantComponentInner(element);
50132      close();
50133    }
50134  }
50135
50136  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element)
50137      throws IOException {
50138    composeBackbone(element);
50139    if (element.hasRole()) {
50140      composeCodeableConcept("role", element.getRole());
50141    }
50142    if (element.hasActor()) {
50143      composeReference("actor", element.getActor());
50144    }
50145  }
50146
50147  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element)
50148      throws IOException {
50149    if (element != null) {
50150      open(name);
50151      composeInvoiceInvoiceLineItemComponentInner(element);
50152      close();
50153    }
50154  }
50155
50156  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element)
50157      throws IOException {
50158    composeBackbone(element);
50159    if (element.hasSequenceElement()) {
50160      composePositiveIntCore("sequence", element.getSequenceElement(), false);
50161      composePositiveIntExtras("sequence", element.getSequenceElement(), false);
50162    }
50163    if (element.hasChargeItem()) {
50164      composeType("chargeItem", element.getChargeItem());
50165    }
50166    if (element.hasPriceComponent()) {
50167      openArray("priceComponent");
50168      for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent())
50169        composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
50170      closeArray();
50171    }
50172    ;
50173  }
50174
50175  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name,
50176      Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
50177    if (element != null) {
50178      open(name);
50179      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
50180      close();
50181    }
50182  }
50183
50184  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(
50185      Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
50186    composeBackbone(element);
50187    if (element.hasTypeElement()) {
50188      composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(),
50189          false);
50190      composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(),
50191          false);
50192    }
50193    if (element.hasCode()) {
50194      composeCodeableConcept("code", element.getCode());
50195    }
50196    if (element.hasFactorElement()) {
50197      composeDecimalCore("factor", element.getFactorElement(), false);
50198      composeDecimalExtras("factor", element.getFactorElement(), false);
50199    }
50200    if (element.hasAmount()) {
50201      composeMoney("amount", element.getAmount());
50202    }
50203  }
50204
50205  protected void composeLibrary(String name, Library element) throws IOException {
50206    if (element != null) {
50207      prop("resourceType", name);
50208      composeLibraryInner(element);
50209    }
50210  }
50211
50212  protected void composeLibraryInner(Library element) throws IOException {
50213    composeDomainResourceElements(element);
50214    if (element.hasUrlElement()) {
50215      composeUriCore("url", element.getUrlElement(), false);
50216      composeUriExtras("url", element.getUrlElement(), false);
50217    }
50218    if (element.hasIdentifier()) {
50219      openArray("identifier");
50220      for (Identifier e : element.getIdentifier())
50221        composeIdentifier(null, e);
50222      closeArray();
50223    }
50224    ;
50225    if (element.hasVersionElement()) {
50226      composeStringCore("version", element.getVersionElement(), false);
50227      composeStringExtras("version", element.getVersionElement(), false);
50228    }
50229    if (element.hasNameElement()) {
50230      composeStringCore("name", element.getNameElement(), false);
50231      composeStringExtras("name", element.getNameElement(), false);
50232    }
50233    if (element.hasTitleElement()) {
50234      composeStringCore("title", element.getTitleElement(), false);
50235      composeStringExtras("title", element.getTitleElement(), false);
50236    }
50237    if (element.hasSubtitleElement()) {
50238      composeStringCore("subtitle", element.getSubtitleElement(), false);
50239      composeStringExtras("subtitle", element.getSubtitleElement(), false);
50240    }
50241    if (element.hasStatusElement()) {
50242      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
50243          false);
50244      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
50245          false);
50246    }
50247    if (element.hasExperimentalElement()) {
50248      composeBooleanCore("experimental", element.getExperimentalElement(), false);
50249      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50250    }
50251    if (element.hasType()) {
50252      composeCodeableConcept("type", element.getType());
50253    }
50254    if (element.hasSubject()) {
50255      composeType("subject", element.getSubject());
50256    }
50257    if (element.hasDateElement()) {
50258      composeDateTimeCore("date", element.getDateElement(), false);
50259      composeDateTimeExtras("date", element.getDateElement(), false);
50260    }
50261    if (element.hasPublisherElement()) {
50262      composeStringCore("publisher", element.getPublisherElement(), false);
50263      composeStringExtras("publisher", element.getPublisherElement(), false);
50264    }
50265    if (element.hasContact()) {
50266      openArray("contact");
50267      for (ContactDetail e : element.getContact())
50268        composeContactDetail(null, e);
50269      closeArray();
50270    }
50271    ;
50272    if (element.hasDescriptionElement()) {
50273      composeMarkdownCore("description", element.getDescriptionElement(), false);
50274      composeMarkdownExtras("description", element.getDescriptionElement(), false);
50275    }
50276    if (element.hasUseContext()) {
50277      openArray("useContext");
50278      for (UsageContext e : element.getUseContext())
50279        composeUsageContext(null, e);
50280      closeArray();
50281    }
50282    ;
50283    if (element.hasJurisdiction()) {
50284      openArray("jurisdiction");
50285      for (CodeableConcept e : element.getJurisdiction())
50286        composeCodeableConcept(null, e);
50287      closeArray();
50288    }
50289    ;
50290    if (element.hasPurposeElement()) {
50291      composeMarkdownCore("purpose", element.getPurposeElement(), false);
50292      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50293    }
50294    if (element.hasUsageElement()) {
50295      composeStringCore("usage", element.getUsageElement(), false);
50296      composeStringExtras("usage", element.getUsageElement(), false);
50297    }
50298    if (element.hasCopyrightElement()) {
50299      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50300      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50301    }
50302    if (element.hasApprovalDateElement()) {
50303      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
50304      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
50305    }
50306    if (element.hasLastReviewDateElement()) {
50307      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
50308      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
50309    }
50310    if (element.hasEffectivePeriod()) {
50311      composePeriod("effectivePeriod", element.getEffectivePeriod());
50312    }
50313    if (element.hasTopic()) {
50314      openArray("topic");
50315      for (CodeableConcept e : element.getTopic())
50316        composeCodeableConcept(null, e);
50317      closeArray();
50318    }
50319    ;
50320    if (element.hasAuthor()) {
50321      openArray("author");
50322      for (ContactDetail e : element.getAuthor())
50323        composeContactDetail(null, e);
50324      closeArray();
50325    }
50326    ;
50327    if (element.hasEditor()) {
50328      openArray("editor");
50329      for (ContactDetail e : element.getEditor())
50330        composeContactDetail(null, e);
50331      closeArray();
50332    }
50333    ;
50334    if (element.hasReviewer()) {
50335      openArray("reviewer");
50336      for (ContactDetail e : element.getReviewer())
50337        composeContactDetail(null, e);
50338      closeArray();
50339    }
50340    ;
50341    if (element.hasEndorser()) {
50342      openArray("endorser");
50343      for (ContactDetail e : element.getEndorser())
50344        composeContactDetail(null, e);
50345      closeArray();
50346    }
50347    ;
50348    if (element.hasRelatedArtifact()) {
50349      openArray("relatedArtifact");
50350      for (RelatedArtifact e : element.getRelatedArtifact())
50351        composeRelatedArtifact(null, e);
50352      closeArray();
50353    }
50354    ;
50355    if (element.hasParameter()) {
50356      openArray("parameter");
50357      for (ParameterDefinition e : element.getParameter())
50358        composeParameterDefinition(null, e);
50359      closeArray();
50360    }
50361    ;
50362    if (element.hasDataRequirement()) {
50363      openArray("dataRequirement");
50364      for (DataRequirement e : element.getDataRequirement())
50365        composeDataRequirement(null, e);
50366      closeArray();
50367    }
50368    ;
50369    if (element.hasContent()) {
50370      openArray("content");
50371      for (Attachment e : element.getContent())
50372        composeAttachment(null, e);
50373      closeArray();
50374    }
50375    ;
50376  }
50377
50378  protected void composeLinkage(String name, Linkage element) throws IOException {
50379    if (element != null) {
50380      prop("resourceType", name);
50381      composeLinkageInner(element);
50382    }
50383  }
50384
50385  protected void composeLinkageInner(Linkage element) throws IOException {
50386    composeDomainResourceElements(element);
50387    if (element.hasActiveElement()) {
50388      composeBooleanCore("active", element.getActiveElement(), false);
50389      composeBooleanExtras("active", element.getActiveElement(), false);
50390    }
50391    if (element.hasAuthor()) {
50392      composeReference("author", element.getAuthor());
50393    }
50394    if (element.hasItem()) {
50395      openArray("item");
50396      for (Linkage.LinkageItemComponent e : element.getItem())
50397        composeLinkageLinkageItemComponent(null, e);
50398      closeArray();
50399    }
50400    ;
50401  }
50402
50403  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element)
50404      throws IOException {
50405    if (element != null) {
50406      open(name);
50407      composeLinkageLinkageItemComponentInner(element);
50408      close();
50409    }
50410  }
50411
50412  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
50413    composeBackbone(element);
50414    if (element.hasTypeElement()) {
50415      composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
50416      composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
50417    }
50418    if (element.hasResource()) {
50419      composeReference("resource", element.getResource());
50420    }
50421  }
50422
50423  protected void composeListResource(String name, ListResource element) throws IOException {
50424    if (element != null) {
50425      prop("resourceType", name);
50426      composeListResourceInner(element);
50427    }
50428  }
50429
50430  protected void composeListResourceInner(ListResource element) throws IOException {
50431    composeDomainResourceElements(element);
50432    if (element.hasIdentifier()) {
50433      openArray("identifier");
50434      for (Identifier e : element.getIdentifier())
50435        composeIdentifier(null, e);
50436      closeArray();
50437    }
50438    ;
50439    if (element.hasStatusElement()) {
50440      composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
50441      composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
50442    }
50443    if (element.hasModeElement()) {
50444      composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
50445      composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
50446    }
50447    if (element.hasTitleElement()) {
50448      composeStringCore("title", element.getTitleElement(), false);
50449      composeStringExtras("title", element.getTitleElement(), false);
50450    }
50451    if (element.hasCode()) {
50452      composeCodeableConcept("code", element.getCode());
50453    }
50454    if (element.hasSubject()) {
50455      composeReference("subject", element.getSubject());
50456    }
50457    if (element.hasEncounter()) {
50458      composeReference("encounter", element.getEncounter());
50459    }
50460    if (element.hasDateElement()) {
50461      composeDateTimeCore("date", element.getDateElement(), false);
50462      composeDateTimeExtras("date", element.getDateElement(), false);
50463    }
50464    if (element.hasSource()) {
50465      composeReference("source", element.getSource());
50466    }
50467    if (element.hasOrderedBy()) {
50468      composeCodeableConcept("orderedBy", element.getOrderedBy());
50469    }
50470    if (element.hasNote()) {
50471      openArray("note");
50472      for (Annotation e : element.getNote())
50473        composeAnnotation(null, e);
50474      closeArray();
50475    }
50476    ;
50477    if (element.hasEntry()) {
50478      openArray("entry");
50479      for (ListResource.ListEntryComponent e : element.getEntry())
50480        composeListResourceListEntryComponent(null, e);
50481      closeArray();
50482    }
50483    ;
50484    if (element.hasEmptyReason()) {
50485      composeCodeableConcept("emptyReason", element.getEmptyReason());
50486    }
50487  }
50488
50489  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element)
50490      throws IOException {
50491    if (element != null) {
50492      open(name);
50493      composeListResourceListEntryComponentInner(element);
50494      close();
50495    }
50496  }
50497
50498  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element)
50499      throws IOException {
50500    composeBackbone(element);
50501    if (element.hasFlag()) {
50502      composeCodeableConcept("flag", element.getFlag());
50503    }
50504    if (element.hasDeletedElement()) {
50505      composeBooleanCore("deleted", element.getDeletedElement(), false);
50506      composeBooleanExtras("deleted", element.getDeletedElement(), false);
50507    }
50508    if (element.hasDateElement()) {
50509      composeDateTimeCore("date", element.getDateElement(), false);
50510      composeDateTimeExtras("date", element.getDateElement(), false);
50511    }
50512    if (element.hasItem()) {
50513      composeReference("item", element.getItem());
50514    }
50515  }
50516
50517  protected void composeLocation(String name, Location element) throws IOException {
50518    if (element != null) {
50519      prop("resourceType", name);
50520      composeLocationInner(element);
50521    }
50522  }
50523
50524  protected void composeLocationInner(Location element) throws IOException {
50525    composeDomainResourceElements(element);
50526    if (element.hasIdentifier()) {
50527      openArray("identifier");
50528      for (Identifier e : element.getIdentifier())
50529        composeIdentifier(null, e);
50530      closeArray();
50531    }
50532    ;
50533    if (element.hasStatusElement()) {
50534      composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
50535      composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
50536    }
50537    if (element.hasOperationalStatus()) {
50538      composeCoding("operationalStatus", element.getOperationalStatus());
50539    }
50540    if (element.hasNameElement()) {
50541      composeStringCore("name", element.getNameElement(), false);
50542      composeStringExtras("name", element.getNameElement(), false);
50543    }
50544    if (element.hasAlias()) {
50545      openArray("alias");
50546      for (StringType e : element.getAlias())
50547        composeStringCore(null, e, true);
50548      closeArray();
50549      if (anyHasExtras(element.getAlias())) {
50550        openArray("_alias");
50551        for (StringType e : element.getAlias())
50552          composeStringExtras(null, e, true);
50553        closeArray();
50554      }
50555    }
50556    ;
50557    if (element.hasDescriptionElement()) {
50558      composeStringCore("description", element.getDescriptionElement(), false);
50559      composeStringExtras("description", element.getDescriptionElement(), false);
50560    }
50561    if (element.hasModeElement()) {
50562      composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
50563      composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
50564    }
50565    if (element.hasType()) {
50566      openArray("type");
50567      for (CodeableConcept e : element.getType())
50568        composeCodeableConcept(null, e);
50569      closeArray();
50570    }
50571    ;
50572    if (element.hasTelecom()) {
50573      openArray("telecom");
50574      for (ContactPoint e : element.getTelecom())
50575        composeContactPoint(null, e);
50576      closeArray();
50577    }
50578    ;
50579    if (element.hasAddress()) {
50580      composeAddress("address", element.getAddress());
50581    }
50582    if (element.hasPhysicalType()) {
50583      composeCodeableConcept("physicalType", element.getPhysicalType());
50584    }
50585    if (element.hasPosition()) {
50586      composeLocationLocationPositionComponent("position", element.getPosition());
50587    }
50588    if (element.hasManagingOrganization()) {
50589      composeReference("managingOrganization", element.getManagingOrganization());
50590    }
50591    if (element.hasPartOf()) {
50592      composeReference("partOf", element.getPartOf());
50593    }
50594    if (element.hasHoursOfOperation()) {
50595      openArray("hoursOfOperation");
50596      for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation())
50597        composeLocationLocationHoursOfOperationComponent(null, e);
50598      closeArray();
50599    }
50600    ;
50601    if (element.hasAvailabilityExceptionsElement()) {
50602      composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50603      composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50604    }
50605    if (element.hasEndpoint()) {
50606      openArray("endpoint");
50607      for (Reference e : element.getEndpoint())
50608        composeReference(null, e);
50609      closeArray();
50610    }
50611    ;
50612  }
50613
50614  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element)
50615      throws IOException {
50616    if (element != null) {
50617      open(name);
50618      composeLocationLocationPositionComponentInner(element);
50619      close();
50620    }
50621  }
50622
50623  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element)
50624      throws IOException {
50625    composeBackbone(element);
50626    if (element.hasLongitudeElement()) {
50627      composeDecimalCore("longitude", element.getLongitudeElement(), false);
50628      composeDecimalExtras("longitude", element.getLongitudeElement(), false);
50629    }
50630    if (element.hasLatitudeElement()) {
50631      composeDecimalCore("latitude", element.getLatitudeElement(), false);
50632      composeDecimalExtras("latitude", element.getLatitudeElement(), false);
50633    }
50634    if (element.hasAltitudeElement()) {
50635      composeDecimalCore("altitude", element.getAltitudeElement(), false);
50636      composeDecimalExtras("altitude", element.getAltitudeElement(), false);
50637    }
50638  }
50639
50640  protected void composeLocationLocationHoursOfOperationComponent(String name,
50641      Location.LocationHoursOfOperationComponent element) throws IOException {
50642    if (element != null) {
50643      open(name);
50644      composeLocationLocationHoursOfOperationComponentInner(element);
50645      close();
50646    }
50647  }
50648
50649  protected void composeLocationLocationHoursOfOperationComponentInner(
50650      Location.LocationHoursOfOperationComponent element) throws IOException {
50651    composeBackbone(element);
50652    if (element.hasDaysOfWeek()) {
50653      openArray("daysOfWeek");
50654      for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek())
50655        composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
50656      closeArray();
50657      if (anyHasExtras(element.getDaysOfWeek())) {
50658        openArray("_daysOfWeek");
50659        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek())
50660          composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
50661        closeArray();
50662      }
50663    }
50664    ;
50665    if (element.hasAllDayElement()) {
50666      composeBooleanCore("allDay", element.getAllDayElement(), false);
50667      composeBooleanExtras("allDay", element.getAllDayElement(), false);
50668    }
50669    if (element.hasOpeningTimeElement()) {
50670      composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
50671      composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
50672    }
50673    if (element.hasClosingTimeElement()) {
50674      composeTimeCore("closingTime", element.getClosingTimeElement(), false);
50675      composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
50676    }
50677  }
50678
50679  protected void composeMeasure(String name, Measure element) throws IOException {
50680    if (element != null) {
50681      prop("resourceType", name);
50682      composeMeasureInner(element);
50683    }
50684  }
50685
50686  protected void composeMeasureInner(Measure element) throws IOException {
50687    composeDomainResourceElements(element);
50688    if (element.hasUrlElement()) {
50689      composeUriCore("url", element.getUrlElement(), false);
50690      composeUriExtras("url", element.getUrlElement(), false);
50691    }
50692    if (element.hasIdentifier()) {
50693      openArray("identifier");
50694      for (Identifier e : element.getIdentifier())
50695        composeIdentifier(null, e);
50696      closeArray();
50697    }
50698    ;
50699    if (element.hasVersionElement()) {
50700      composeStringCore("version", element.getVersionElement(), false);
50701      composeStringExtras("version", element.getVersionElement(), false);
50702    }
50703    if (element.hasNameElement()) {
50704      composeStringCore("name", element.getNameElement(), false);
50705      composeStringExtras("name", element.getNameElement(), false);
50706    }
50707    if (element.hasTitleElement()) {
50708      composeStringCore("title", element.getTitleElement(), false);
50709      composeStringExtras("title", element.getTitleElement(), false);
50710    }
50711    if (element.hasSubtitleElement()) {
50712      composeStringCore("subtitle", element.getSubtitleElement(), false);
50713      composeStringExtras("subtitle", element.getSubtitleElement(), false);
50714    }
50715    if (element.hasStatusElement()) {
50716      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
50717          false);
50718      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
50719          false);
50720    }
50721    if (element.hasExperimentalElement()) {
50722      composeBooleanCore("experimental", element.getExperimentalElement(), false);
50723      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50724    }
50725    if (element.hasSubject()) {
50726      composeType("subject", element.getSubject());
50727    }
50728    if (element.hasDateElement()) {
50729      composeDateTimeCore("date", element.getDateElement(), false);
50730      composeDateTimeExtras("date", element.getDateElement(), false);
50731    }
50732    if (element.hasPublisherElement()) {
50733      composeStringCore("publisher", element.getPublisherElement(), false);
50734      composeStringExtras("publisher", element.getPublisherElement(), false);
50735    }
50736    if (element.hasContact()) {
50737      openArray("contact");
50738      for (ContactDetail e : element.getContact())
50739        composeContactDetail(null, e);
50740      closeArray();
50741    }
50742    ;
50743    if (element.hasDescriptionElement()) {
50744      composeMarkdownCore("description", element.getDescriptionElement(), false);
50745      composeMarkdownExtras("description", element.getDescriptionElement(), false);
50746    }
50747    if (element.hasUseContext()) {
50748      openArray("useContext");
50749      for (UsageContext e : element.getUseContext())
50750        composeUsageContext(null, e);
50751      closeArray();
50752    }
50753    ;
50754    if (element.hasJurisdiction()) {
50755      openArray("jurisdiction");
50756      for (CodeableConcept e : element.getJurisdiction())
50757        composeCodeableConcept(null, e);
50758      closeArray();
50759    }
50760    ;
50761    if (element.hasPurposeElement()) {
50762      composeMarkdownCore("purpose", element.getPurposeElement(), false);
50763      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50764    }
50765    if (element.hasUsageElement()) {
50766      composeStringCore("usage", element.getUsageElement(), false);
50767      composeStringExtras("usage", element.getUsageElement(), false);
50768    }
50769    if (element.hasCopyrightElement()) {
50770      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50771      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50772    }
50773    if (element.hasApprovalDateElement()) {
50774      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
50775      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
50776    }
50777    if (element.hasLastReviewDateElement()) {
50778      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
50779      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
50780    }
50781    if (element.hasEffectivePeriod()) {
50782      composePeriod("effectivePeriod", element.getEffectivePeriod());
50783    }
50784    if (element.hasTopic()) {
50785      openArray("topic");
50786      for (CodeableConcept e : element.getTopic())
50787        composeCodeableConcept(null, e);
50788      closeArray();
50789    }
50790    ;
50791    if (element.hasAuthor()) {
50792      openArray("author");
50793      for (ContactDetail e : element.getAuthor())
50794        composeContactDetail(null, e);
50795      closeArray();
50796    }
50797    ;
50798    if (element.hasEditor()) {
50799      openArray("editor");
50800      for (ContactDetail e : element.getEditor())
50801        composeContactDetail(null, e);
50802      closeArray();
50803    }
50804    ;
50805    if (element.hasReviewer()) {
50806      openArray("reviewer");
50807      for (ContactDetail e : element.getReviewer())
50808        composeContactDetail(null, e);
50809      closeArray();
50810    }
50811    ;
50812    if (element.hasEndorser()) {
50813      openArray("endorser");
50814      for (ContactDetail e : element.getEndorser())
50815        composeContactDetail(null, e);
50816      closeArray();
50817    }
50818    ;
50819    if (element.hasRelatedArtifact()) {
50820      openArray("relatedArtifact");
50821      for (RelatedArtifact e : element.getRelatedArtifact())
50822        composeRelatedArtifact(null, e);
50823      closeArray();
50824    }
50825    ;
50826    if (element.hasLibrary()) {
50827      openArray("library");
50828      for (CanonicalType e : element.getLibrary())
50829        composeCanonicalCore(null, e, true);
50830      closeArray();
50831      if (anyHasExtras(element.getLibrary())) {
50832        openArray("_library");
50833        for (CanonicalType e : element.getLibrary())
50834          composeCanonicalExtras(null, e, true);
50835        closeArray();
50836      }
50837    }
50838    ;
50839    if (element.hasDisclaimerElement()) {
50840      composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
50841      composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
50842    }
50843    if (element.hasScoring()) {
50844      composeCodeableConcept("scoring", element.getScoring());
50845    }
50846    if (element.hasCompositeScoring()) {
50847      composeCodeableConcept("compositeScoring", element.getCompositeScoring());
50848    }
50849    if (element.hasType()) {
50850      openArray("type");
50851      for (CodeableConcept e : element.getType())
50852        composeCodeableConcept(null, e);
50853      closeArray();
50854    }
50855    ;
50856    if (element.hasRiskAdjustmentElement()) {
50857      composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
50858      composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
50859    }
50860    if (element.hasRateAggregationElement()) {
50861      composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
50862      composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
50863    }
50864    if (element.hasRationaleElement()) {
50865      composeMarkdownCore("rationale", element.getRationaleElement(), false);
50866      composeMarkdownExtras("rationale", element.getRationaleElement(), false);
50867    }
50868    if (element.hasClinicalRecommendationStatementElement()) {
50869      composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(),
50870          false);
50871      composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(),
50872          false);
50873    }
50874    if (element.hasImprovementNotation()) {
50875      composeCodeableConcept("improvementNotation", element.getImprovementNotation());
50876    }
50877    if (element.hasDefinition()) {
50878      openArray("definition");
50879      for (MarkdownType e : element.getDefinition())
50880        composeMarkdownCore(null, e, true);
50881      closeArray();
50882      if (anyHasExtras(element.getDefinition())) {
50883        openArray("_definition");
50884        for (MarkdownType e : element.getDefinition())
50885          composeMarkdownExtras(null, e, true);
50886        closeArray();
50887      }
50888    }
50889    ;
50890    if (element.hasGuidanceElement()) {
50891      composeMarkdownCore("guidance", element.getGuidanceElement(), false);
50892      composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
50893    }
50894    if (element.hasGroup()) {
50895      openArray("group");
50896      for (Measure.MeasureGroupComponent e : element.getGroup())
50897        composeMeasureMeasureGroupComponent(null, e);
50898      closeArray();
50899    }
50900    ;
50901    if (element.hasSupplementalData()) {
50902      openArray("supplementalData");
50903      for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData())
50904        composeMeasureMeasureSupplementalDataComponent(null, e);
50905      closeArray();
50906    }
50907    ;
50908  }
50909
50910  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element)
50911      throws IOException {
50912    if (element != null) {
50913      open(name);
50914      composeMeasureMeasureGroupComponentInner(element);
50915      close();
50916    }
50917  }
50918
50919  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
50920    composeBackbone(element);
50921    if (element.hasCode()) {
50922      composeCodeableConcept("code", element.getCode());
50923    }
50924    if (element.hasDescriptionElement()) {
50925      composeStringCore("description", element.getDescriptionElement(), false);
50926      composeStringExtras("description", element.getDescriptionElement(), false);
50927    }
50928    if (element.hasPopulation()) {
50929      openArray("population");
50930      for (Measure.MeasureGroupPopulationComponent e : element.getPopulation())
50931        composeMeasureMeasureGroupPopulationComponent(null, e);
50932      closeArray();
50933    }
50934    ;
50935    if (element.hasStratifier()) {
50936      openArray("stratifier");
50937      for (Measure.MeasureGroupStratifierComponent e : element.getStratifier())
50938        composeMeasureMeasureGroupStratifierComponent(null, e);
50939      closeArray();
50940    }
50941    ;
50942  }
50943
50944  protected void composeMeasureMeasureGroupPopulationComponent(String name,
50945      Measure.MeasureGroupPopulationComponent element) throws IOException {
50946    if (element != null) {
50947      open(name);
50948      composeMeasureMeasureGroupPopulationComponentInner(element);
50949      close();
50950    }
50951  }
50952
50953  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element)
50954      throws IOException {
50955    composeBackbone(element);
50956    if (element.hasCode()) {
50957      composeCodeableConcept("code", element.getCode());
50958    }
50959    if (element.hasDescriptionElement()) {
50960      composeStringCore("description", element.getDescriptionElement(), false);
50961      composeStringExtras("description", element.getDescriptionElement(), false);
50962    }
50963    if (element.hasCriteria()) {
50964      composeExpression("criteria", element.getCriteria());
50965    }
50966  }
50967
50968  protected void composeMeasureMeasureGroupStratifierComponent(String name,
50969      Measure.MeasureGroupStratifierComponent element) throws IOException {
50970    if (element != null) {
50971      open(name);
50972      composeMeasureMeasureGroupStratifierComponentInner(element);
50973      close();
50974    }
50975  }
50976
50977  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element)
50978      throws IOException {
50979    composeBackbone(element);
50980    if (element.hasCode()) {
50981      composeCodeableConcept("code", element.getCode());
50982    }
50983    if (element.hasDescriptionElement()) {
50984      composeStringCore("description", element.getDescriptionElement(), false);
50985      composeStringExtras("description", element.getDescriptionElement(), false);
50986    }
50987    if (element.hasCriteria()) {
50988      composeExpression("criteria", element.getCriteria());
50989    }
50990    if (element.hasComponent()) {
50991      openArray("component");
50992      for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent())
50993        composeMeasureMeasureGroupStratifierComponentComponent(null, e);
50994      closeArray();
50995    }
50996    ;
50997  }
50998
50999  protected void composeMeasureMeasureGroupStratifierComponentComponent(String name,
51000      Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
51001    if (element != null) {
51002      open(name);
51003      composeMeasureMeasureGroupStratifierComponentComponentInner(element);
51004      close();
51005    }
51006  }
51007
51008  protected void composeMeasureMeasureGroupStratifierComponentComponentInner(
51009      Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
51010    composeBackbone(element);
51011    if (element.hasCode()) {
51012      composeCodeableConcept("code", element.getCode());
51013    }
51014    if (element.hasDescriptionElement()) {
51015      composeStringCore("description", element.getDescriptionElement(), false);
51016      composeStringExtras("description", element.getDescriptionElement(), false);
51017    }
51018    if (element.hasCriteria()) {
51019      composeExpression("criteria", element.getCriteria());
51020    }
51021  }
51022
51023  protected void composeMeasureMeasureSupplementalDataComponent(String name,
51024      Measure.MeasureSupplementalDataComponent element) throws IOException {
51025    if (element != null) {
51026      open(name);
51027      composeMeasureMeasureSupplementalDataComponentInner(element);
51028      close();
51029    }
51030  }
51031
51032  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element)
51033      throws IOException {
51034    composeBackbone(element);
51035    if (element.hasCode()) {
51036      composeCodeableConcept("code", element.getCode());
51037    }
51038    if (element.hasUsage()) {
51039      openArray("usage");
51040      for (CodeableConcept e : element.getUsage())
51041        composeCodeableConcept(null, e);
51042      closeArray();
51043    }
51044    ;
51045    if (element.hasDescriptionElement()) {
51046      composeStringCore("description", element.getDescriptionElement(), false);
51047      composeStringExtras("description", element.getDescriptionElement(), false);
51048    }
51049    if (element.hasCriteria()) {
51050      composeExpression("criteria", element.getCriteria());
51051    }
51052  }
51053
51054  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
51055    if (element != null) {
51056      prop("resourceType", name);
51057      composeMeasureReportInner(element);
51058    }
51059  }
51060
51061  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
51062    composeDomainResourceElements(element);
51063    if (element.hasIdentifier()) {
51064      openArray("identifier");
51065      for (Identifier e : element.getIdentifier())
51066        composeIdentifier(null, e);
51067      closeArray();
51068    }
51069    ;
51070    if (element.hasStatusElement()) {
51071      composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(),
51072          false);
51073      composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(),
51074          false);
51075    }
51076    if (element.hasTypeElement()) {
51077      composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
51078      composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(),
51079          false);
51080    }
51081    if (element.hasMeasureElement()) {
51082      composeCanonicalCore("measure", element.getMeasureElement(), false);
51083      composeCanonicalExtras("measure", element.getMeasureElement(), false);
51084    }
51085    if (element.hasSubject()) {
51086      composeReference("subject", element.getSubject());
51087    }
51088    if (element.hasDateElement()) {
51089      composeDateTimeCore("date", element.getDateElement(), false);
51090      composeDateTimeExtras("date", element.getDateElement(), false);
51091    }
51092    if (element.hasReporter()) {
51093      composeReference("reporter", element.getReporter());
51094    }
51095    if (element.hasPeriod()) {
51096      composePeriod("period", element.getPeriod());
51097    }
51098    if (element.hasImprovementNotation()) {
51099      composeCodeableConcept("improvementNotation", element.getImprovementNotation());
51100    }
51101    if (element.hasGroup()) {
51102      openArray("group");
51103      for (MeasureReport.MeasureReportGroupComponent e : element.getGroup())
51104        composeMeasureReportMeasureReportGroupComponent(null, e);
51105      closeArray();
51106    }
51107    ;
51108    if (element.hasEvaluatedResource()) {
51109      openArray("evaluatedResource");
51110      for (Reference e : element.getEvaluatedResource())
51111        composeReference(null, e);
51112      closeArray();
51113    }
51114    ;
51115  }
51116
51117  protected void composeMeasureReportMeasureReportGroupComponent(String name,
51118      MeasureReport.MeasureReportGroupComponent element) throws IOException {
51119    if (element != null) {
51120      open(name);
51121      composeMeasureReportMeasureReportGroupComponentInner(element);
51122      close();
51123    }
51124  }
51125
51126  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element)
51127      throws IOException {
51128    composeBackbone(element);
51129    if (element.hasCode()) {
51130      composeCodeableConcept("code", element.getCode());
51131    }
51132    if (element.hasPopulation()) {
51133      openArray("population");
51134      for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation())
51135        composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
51136      closeArray();
51137    }
51138    ;
51139    if (element.hasMeasureScore()) {
51140      composeQuantity("measureScore", element.getMeasureScore());
51141    }
51142    if (element.hasStratifier()) {
51143      openArray("stratifier");
51144      for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier())
51145        composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
51146      closeArray();
51147    }
51148    ;
51149  }
51150
51151  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name,
51152      MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
51153    if (element != null) {
51154      open(name);
51155      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
51156      close();
51157    }
51158  }
51159
51160  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(
51161      MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
51162    composeBackbone(element);
51163    if (element.hasCode()) {
51164      composeCodeableConcept("code", element.getCode());
51165    }
51166    if (element.hasCountElement()) {
51167      composeIntegerCore("count", element.getCountElement(), false);
51168      composeIntegerExtras("count", element.getCountElement(), false);
51169    }
51170    if (element.hasSubjectResults()) {
51171      composeReference("subjectResults", element.getSubjectResults());
51172    }
51173  }
51174
51175  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name,
51176      MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
51177    if (element != null) {
51178      open(name);
51179      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
51180      close();
51181    }
51182  }
51183
51184  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(
51185      MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
51186    composeBackbone(element);
51187    if (element.hasCode()) {
51188      openArray("code");
51189      for (CodeableConcept e : element.getCode())
51190        composeCodeableConcept(null, e);
51191      closeArray();
51192    }
51193    ;
51194    if (element.hasStratum()) {
51195      openArray("stratum");
51196      for (MeasureReport.StratifierGroupComponent e : element.getStratum())
51197        composeMeasureReportStratifierGroupComponent(null, e);
51198      closeArray();
51199    }
51200    ;
51201  }
51202
51203  protected void composeMeasureReportStratifierGroupComponent(String name,
51204      MeasureReport.StratifierGroupComponent element) throws IOException {
51205    if (element != null) {
51206      open(name);
51207      composeMeasureReportStratifierGroupComponentInner(element);
51208      close();
51209    }
51210  }
51211
51212  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element)
51213      throws IOException {
51214    composeBackbone(element);
51215    if (element.hasValue()) {
51216      composeCodeableConcept("value", element.getValue());
51217    }
51218    if (element.hasComponent()) {
51219      openArray("component");
51220      for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent())
51221        composeMeasureReportStratifierGroupComponentComponent(null, e);
51222      closeArray();
51223    }
51224    ;
51225    if (element.hasPopulation()) {
51226      openArray("population");
51227      for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation())
51228        composeMeasureReportStratifierGroupPopulationComponent(null, e);
51229      closeArray();
51230    }
51231    ;
51232    if (element.hasMeasureScore()) {
51233      composeQuantity("measureScore", element.getMeasureScore());
51234    }
51235  }
51236
51237  protected void composeMeasureReportStratifierGroupComponentComponent(String name,
51238      MeasureReport.StratifierGroupComponentComponent element) throws IOException {
51239    if (element != null) {
51240      open(name);
51241      composeMeasureReportStratifierGroupComponentComponentInner(element);
51242      close();
51243    }
51244  }
51245
51246  protected void composeMeasureReportStratifierGroupComponentComponentInner(
51247      MeasureReport.StratifierGroupComponentComponent element) throws IOException {
51248    composeBackbone(element);
51249    if (element.hasCode()) {
51250      composeCodeableConcept("code", element.getCode());
51251    }
51252    if (element.hasValue()) {
51253      composeCodeableConcept("value", element.getValue());
51254    }
51255  }
51256
51257  protected void composeMeasureReportStratifierGroupPopulationComponent(String name,
51258      MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
51259    if (element != null) {
51260      open(name);
51261      composeMeasureReportStratifierGroupPopulationComponentInner(element);
51262      close();
51263    }
51264  }
51265
51266  protected void composeMeasureReportStratifierGroupPopulationComponentInner(
51267      MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
51268    composeBackbone(element);
51269    if (element.hasCode()) {
51270      composeCodeableConcept("code", element.getCode());
51271    }
51272    if (element.hasCountElement()) {
51273      composeIntegerCore("count", element.getCountElement(), false);
51274      composeIntegerExtras("count", element.getCountElement(), false);
51275    }
51276    if (element.hasSubjectResults()) {
51277      composeReference("subjectResults", element.getSubjectResults());
51278    }
51279  }
51280
51281  protected void composeMedia(String name, Media element) throws IOException {
51282    if (element != null) {
51283      prop("resourceType", name);
51284      composeMediaInner(element);
51285    }
51286  }
51287
51288  protected void composeMediaInner(Media element) throws IOException {
51289    composeDomainResourceElements(element);
51290    if (element.hasIdentifier()) {
51291      openArray("identifier");
51292      for (Identifier e : element.getIdentifier())
51293        composeIdentifier(null, e);
51294      closeArray();
51295    }
51296    ;
51297    if (element.hasBasedOn()) {
51298      openArray("basedOn");
51299      for (Reference e : element.getBasedOn())
51300        composeReference(null, e);
51301      closeArray();
51302    }
51303    ;
51304    if (element.hasPartOf()) {
51305      openArray("partOf");
51306      for (Reference e : element.getPartOf())
51307        composeReference(null, e);
51308      closeArray();
51309    }
51310    ;
51311    if (element.hasStatusElement()) {
51312      composeEnumerationCore("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
51313      composeEnumerationExtras("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
51314    }
51315    if (element.hasType()) {
51316      composeCodeableConcept("type", element.getType());
51317    }
51318    if (element.hasModality()) {
51319      composeCodeableConcept("modality", element.getModality());
51320    }
51321    if (element.hasView()) {
51322      composeCodeableConcept("view", element.getView());
51323    }
51324    if (element.hasSubject()) {
51325      composeReference("subject", element.getSubject());
51326    }
51327    if (element.hasEncounter()) {
51328      composeReference("encounter", element.getEncounter());
51329    }
51330    if (element.hasCreated()) {
51331      composeType("created", element.getCreated());
51332    }
51333    if (element.hasIssuedElement()) {
51334      composeInstantCore("issued", element.getIssuedElement(), false);
51335      composeInstantExtras("issued", element.getIssuedElement(), false);
51336    }
51337    if (element.hasOperator()) {
51338      composeReference("operator", element.getOperator());
51339    }
51340    if (element.hasReasonCode()) {
51341      openArray("reasonCode");
51342      for (CodeableConcept e : element.getReasonCode())
51343        composeCodeableConcept(null, e);
51344      closeArray();
51345    }
51346    ;
51347    if (element.hasBodySite()) {
51348      composeCodeableConcept("bodySite", element.getBodySite());
51349    }
51350    if (element.hasDeviceNameElement()) {
51351      composeStringCore("deviceName", element.getDeviceNameElement(), false);
51352      composeStringExtras("deviceName", element.getDeviceNameElement(), false);
51353    }
51354    if (element.hasDevice()) {
51355      composeReference("device", element.getDevice());
51356    }
51357    if (element.hasHeightElement()) {
51358      composePositiveIntCore("height", element.getHeightElement(), false);
51359      composePositiveIntExtras("height", element.getHeightElement(), false);
51360    }
51361    if (element.hasWidthElement()) {
51362      composePositiveIntCore("width", element.getWidthElement(), false);
51363      composePositiveIntExtras("width", element.getWidthElement(), false);
51364    }
51365    if (element.hasFramesElement()) {
51366      composePositiveIntCore("frames", element.getFramesElement(), false);
51367      composePositiveIntExtras("frames", element.getFramesElement(), false);
51368    }
51369    if (element.hasDurationElement()) {
51370      composeDecimalCore("duration", element.getDurationElement(), false);
51371      composeDecimalExtras("duration", element.getDurationElement(), false);
51372    }
51373    if (element.hasContent()) {
51374      composeAttachment("content", element.getContent());
51375    }
51376    if (element.hasNote()) {
51377      openArray("note");
51378      for (Annotation e : element.getNote())
51379        composeAnnotation(null, e);
51380      closeArray();
51381    }
51382    ;
51383  }
51384
51385  protected void composeMedication(String name, Medication element) throws IOException {
51386    if (element != null) {
51387      prop("resourceType", name);
51388      composeMedicationInner(element);
51389    }
51390  }
51391
51392  protected void composeMedicationInner(Medication element) throws IOException {
51393    composeDomainResourceElements(element);
51394    if (element.hasIdentifier()) {
51395      openArray("identifier");
51396      for (Identifier e : element.getIdentifier())
51397        composeIdentifier(null, e);
51398      closeArray();
51399    }
51400    ;
51401    if (element.hasCode()) {
51402      composeCodeableConcept("code", element.getCode());
51403    }
51404    if (element.hasStatusElement()) {
51405      composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
51406      composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(),
51407          false);
51408    }
51409    if (element.hasManufacturer()) {
51410      composeReference("manufacturer", element.getManufacturer());
51411    }
51412    if (element.hasForm()) {
51413      composeCodeableConcept("form", element.getForm());
51414    }
51415    if (element.hasAmount()) {
51416      composeRatio("amount", element.getAmount());
51417    }
51418    if (element.hasIngredient()) {
51419      openArray("ingredient");
51420      for (Medication.MedicationIngredientComponent e : element.getIngredient())
51421        composeMedicationMedicationIngredientComponent(null, e);
51422      closeArray();
51423    }
51424    ;
51425    if (element.hasBatch()) {
51426      composeMedicationMedicationBatchComponent("batch", element.getBatch());
51427    }
51428  }
51429
51430  protected void composeMedicationMedicationIngredientComponent(String name,
51431      Medication.MedicationIngredientComponent element) throws IOException {
51432    if (element != null) {
51433      open(name);
51434      composeMedicationMedicationIngredientComponentInner(element);
51435      close();
51436    }
51437  }
51438
51439  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element)
51440      throws IOException {
51441    composeBackbone(element);
51442    if (element.hasItem()) {
51443      composeType("item", element.getItem());
51444    }
51445    if (element.hasIsActiveElement()) {
51446      composeBooleanCore("isActive", element.getIsActiveElement(), false);
51447      composeBooleanExtras("isActive", element.getIsActiveElement(), false);
51448    }
51449    if (element.hasStrength()) {
51450      composeRatio("strength", element.getStrength());
51451    }
51452  }
51453
51454  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element)
51455      throws IOException {
51456    if (element != null) {
51457      open(name);
51458      composeMedicationMedicationBatchComponentInner(element);
51459      close();
51460    }
51461  }
51462
51463  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element)
51464      throws IOException {
51465    composeBackbone(element);
51466    if (element.hasLotNumberElement()) {
51467      composeStringCore("lotNumber", element.getLotNumberElement(), false);
51468      composeStringExtras("lotNumber", element.getLotNumberElement(), false);
51469    }
51470    if (element.hasExpirationDateElement()) {
51471      composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
51472      composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
51473    }
51474  }
51475
51476  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
51477    if (element != null) {
51478      prop("resourceType", name);
51479      composeMedicationAdministrationInner(element);
51480    }
51481  }
51482
51483  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
51484    composeDomainResourceElements(element);
51485    if (element.hasIdentifier()) {
51486      openArray("identifier");
51487      for (Identifier e : element.getIdentifier())
51488        composeIdentifier(null, e);
51489      closeArray();
51490    }
51491    ;
51492    if (element.hasInstantiates()) {
51493      openArray("instantiates");
51494      for (UriType e : element.getInstantiates())
51495        composeUriCore(null, e, true);
51496      closeArray();
51497      if (anyHasExtras(element.getInstantiates())) {
51498        openArray("_instantiates");
51499        for (UriType e : element.getInstantiates())
51500          composeUriExtras(null, e, true);
51501        closeArray();
51502      }
51503    }
51504    ;
51505    if (element.hasPartOf()) {
51506      openArray("partOf");
51507      for (Reference e : element.getPartOf())
51508        composeReference(null, e);
51509      closeArray();
51510    }
51511    ;
51512    if (element.hasStatusElement()) {
51513      composeEnumerationCore("status", element.getStatusElement(),
51514          new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
51515      composeEnumerationExtras("status", element.getStatusElement(),
51516          new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
51517    }
51518    if (element.hasStatusReason()) {
51519      openArray("statusReason");
51520      for (CodeableConcept e : element.getStatusReason())
51521        composeCodeableConcept(null, e);
51522      closeArray();
51523    }
51524    ;
51525    if (element.hasCategory()) {
51526      composeCodeableConcept("category", element.getCategory());
51527    }
51528    if (element.hasMedication()) {
51529      composeType("medication", element.getMedication());
51530    }
51531    if (element.hasSubject()) {
51532      composeReference("subject", element.getSubject());
51533    }
51534    if (element.hasContext()) {
51535      composeReference("context", element.getContext());
51536    }
51537    if (element.hasSupportingInformation()) {
51538      openArray("supportingInformation");
51539      for (Reference e : element.getSupportingInformation())
51540        composeReference(null, e);
51541      closeArray();
51542    }
51543    ;
51544    if (element.hasEffective()) {
51545      composeType("effective", element.getEffective());
51546    }
51547    if (element.hasPerformer()) {
51548      openArray("performer");
51549      for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer())
51550        composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
51551      closeArray();
51552    }
51553    ;
51554    if (element.hasReasonCode()) {
51555      openArray("reasonCode");
51556      for (CodeableConcept e : element.getReasonCode())
51557        composeCodeableConcept(null, e);
51558      closeArray();
51559    }
51560    ;
51561    if (element.hasReasonReference()) {
51562      openArray("reasonReference");
51563      for (Reference e : element.getReasonReference())
51564        composeReference(null, e);
51565      closeArray();
51566    }
51567    ;
51568    if (element.hasRequest()) {
51569      composeReference("request", element.getRequest());
51570    }
51571    if (element.hasDevice()) {
51572      openArray("device");
51573      for (Reference e : element.getDevice())
51574        composeReference(null, e);
51575      closeArray();
51576    }
51577    ;
51578    if (element.hasNote()) {
51579      openArray("note");
51580      for (Annotation e : element.getNote())
51581        composeAnnotation(null, e);
51582      closeArray();
51583    }
51584    ;
51585    if (element.hasDosage()) {
51586      composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
51587    }
51588    if (element.hasEventHistory()) {
51589      openArray("eventHistory");
51590      for (Reference e : element.getEventHistory())
51591        composeReference(null, e);
51592      closeArray();
51593    }
51594    ;
51595  }
51596
51597  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name,
51598      MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
51599    if (element != null) {
51600      open(name);
51601      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
51602      close();
51603    }
51604  }
51605
51606  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(
51607      MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
51608    composeBackbone(element);
51609    if (element.hasFunction()) {
51610      composeCodeableConcept("function", element.getFunction());
51611    }
51612    if (element.hasActor()) {
51613      composeReference("actor", element.getActor());
51614    }
51615  }
51616
51617  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name,
51618      MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
51619    if (element != null) {
51620      open(name);
51621      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
51622      close();
51623    }
51624  }
51625
51626  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(
51627      MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
51628    composeBackbone(element);
51629    if (element.hasTextElement()) {
51630      composeStringCore("text", element.getTextElement(), false);
51631      composeStringExtras("text", element.getTextElement(), false);
51632    }
51633    if (element.hasSite()) {
51634      composeCodeableConcept("site", element.getSite());
51635    }
51636    if (element.hasRoute()) {
51637      composeCodeableConcept("route", element.getRoute());
51638    }
51639    if (element.hasMethod()) {
51640      composeCodeableConcept("method", element.getMethod());
51641    }
51642    if (element.hasDose()) {
51643      composeQuantity("dose", element.getDose());
51644    }
51645    if (element.hasRate()) {
51646      composeType("rate", element.getRate());
51647    }
51648  }
51649
51650  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
51651    if (element != null) {
51652      prop("resourceType", name);
51653      composeMedicationDispenseInner(element);
51654    }
51655  }
51656
51657  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
51658    composeDomainResourceElements(element);
51659    if (element.hasIdentifier()) {
51660      openArray("identifier");
51661      for (Identifier e : element.getIdentifier())
51662        composeIdentifier(null, e);
51663      closeArray();
51664    }
51665    ;
51666    if (element.hasPartOf()) {
51667      openArray("partOf");
51668      for (Reference e : element.getPartOf())
51669        composeReference(null, e);
51670      closeArray();
51671    }
51672    ;
51673    if (element.hasStatusElement()) {
51674      composeEnumerationCore("status", element.getStatusElement(),
51675          new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
51676      composeEnumerationExtras("status", element.getStatusElement(),
51677          new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
51678    }
51679    if (element.hasStatusReason()) {
51680      composeType("statusReason", element.getStatusReason());
51681    }
51682    if (element.hasCategory()) {
51683      composeCodeableConcept("category", element.getCategory());
51684    }
51685    if (element.hasMedication()) {
51686      composeType("medication", element.getMedication());
51687    }
51688    if (element.hasSubject()) {
51689      composeReference("subject", element.getSubject());
51690    }
51691    if (element.hasContext()) {
51692      composeReference("context", element.getContext());
51693    }
51694    if (element.hasSupportingInformation()) {
51695      openArray("supportingInformation");
51696      for (Reference e : element.getSupportingInformation())
51697        composeReference(null, e);
51698      closeArray();
51699    }
51700    ;
51701    if (element.hasPerformer()) {
51702      openArray("performer");
51703      for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer())
51704        composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
51705      closeArray();
51706    }
51707    ;
51708    if (element.hasLocation()) {
51709      composeReference("location", element.getLocation());
51710    }
51711    if (element.hasAuthorizingPrescription()) {
51712      openArray("authorizingPrescription");
51713      for (Reference e : element.getAuthorizingPrescription())
51714        composeReference(null, e);
51715      closeArray();
51716    }
51717    ;
51718    if (element.hasType()) {
51719      composeCodeableConcept("type", element.getType());
51720    }
51721    if (element.hasQuantity()) {
51722      composeQuantity("quantity", element.getQuantity());
51723    }
51724    if (element.hasDaysSupply()) {
51725      composeQuantity("daysSupply", element.getDaysSupply());
51726    }
51727    if (element.hasWhenPreparedElement()) {
51728      composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
51729      composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
51730    }
51731    if (element.hasWhenHandedOverElement()) {
51732      composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
51733      composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
51734    }
51735    if (element.hasDestination()) {
51736      composeReference("destination", element.getDestination());
51737    }
51738    if (element.hasReceiver()) {
51739      openArray("receiver");
51740      for (Reference e : element.getReceiver())
51741        composeReference(null, e);
51742      closeArray();
51743    }
51744    ;
51745    if (element.hasNote()) {
51746      openArray("note");
51747      for (Annotation e : element.getNote())
51748        composeAnnotation(null, e);
51749      closeArray();
51750    }
51751    ;
51752    if (element.hasDosageInstruction()) {
51753      openArray("dosageInstruction");
51754      for (Dosage e : element.getDosageInstruction())
51755        composeDosage(null, e);
51756      closeArray();
51757    }
51758    ;
51759    if (element.hasSubstitution()) {
51760      composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
51761    }
51762    if (element.hasDetectedIssue()) {
51763      openArray("detectedIssue");
51764      for (Reference e : element.getDetectedIssue())
51765        composeReference(null, e);
51766      closeArray();
51767    }
51768    ;
51769    if (element.hasEventHistory()) {
51770      openArray("eventHistory");
51771      for (Reference e : element.getEventHistory())
51772        composeReference(null, e);
51773      closeArray();
51774    }
51775    ;
51776  }
51777
51778  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name,
51779      MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
51780    if (element != null) {
51781      open(name);
51782      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
51783      close();
51784    }
51785  }
51786
51787  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(
51788      MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
51789    composeBackbone(element);
51790    if (element.hasFunction()) {
51791      composeCodeableConcept("function", element.getFunction());
51792    }
51793    if (element.hasActor()) {
51794      composeReference("actor", element.getActor());
51795    }
51796  }
51797
51798  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name,
51799      MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
51800    if (element != null) {
51801      open(name);
51802      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
51803      close();
51804    }
51805  }
51806
51807  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(
51808      MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
51809    composeBackbone(element);
51810    if (element.hasWasSubstitutedElement()) {
51811      composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
51812      composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
51813    }
51814    if (element.hasType()) {
51815      composeCodeableConcept("type", element.getType());
51816    }
51817    if (element.hasReason()) {
51818      openArray("reason");
51819      for (CodeableConcept e : element.getReason())
51820        composeCodeableConcept(null, e);
51821      closeArray();
51822    }
51823    ;
51824    if (element.hasResponsibleParty()) {
51825      openArray("responsibleParty");
51826      for (Reference e : element.getResponsibleParty())
51827        composeReference(null, e);
51828      closeArray();
51829    }
51830    ;
51831  }
51832
51833  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
51834    if (element != null) {
51835      prop("resourceType", name);
51836      composeMedicationKnowledgeInner(element);
51837    }
51838  }
51839
51840  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
51841    composeDomainResourceElements(element);
51842    if (element.hasCode()) {
51843      composeCodeableConcept("code", element.getCode());
51844    }
51845    if (element.hasStatusElement()) {
51846      composeEnumerationCore("status", element.getStatusElement(),
51847          new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
51848      composeEnumerationExtras("status", element.getStatusElement(),
51849          new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
51850    }
51851    if (element.hasManufacturer()) {
51852      composeReference("manufacturer", element.getManufacturer());
51853    }
51854    if (element.hasDoseForm()) {
51855      composeCodeableConcept("doseForm", element.getDoseForm());
51856    }
51857    if (element.hasAmount()) {
51858      composeQuantity("amount", element.getAmount());
51859    }
51860    if (element.hasSynonym()) {
51861      openArray("synonym");
51862      for (StringType e : element.getSynonym())
51863        composeStringCore(null, e, true);
51864      closeArray();
51865      if (anyHasExtras(element.getSynonym())) {
51866        openArray("_synonym");
51867        for (StringType e : element.getSynonym())
51868          composeStringExtras(null, e, true);
51869        closeArray();
51870      }
51871    }
51872    ;
51873    if (element.hasRelatedMedicationKnowledge()) {
51874      openArray("relatedMedicationKnowledge");
51875      for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element
51876          .getRelatedMedicationKnowledge())
51877        composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
51878      closeArray();
51879    }
51880    ;
51881    if (element.hasAssociatedMedication()) {
51882      openArray("associatedMedication");
51883      for (Reference e : element.getAssociatedMedication())
51884        composeReference(null, e);
51885      closeArray();
51886    }
51887    ;
51888    if (element.hasProductType()) {
51889      openArray("productType");
51890      for (CodeableConcept e : element.getProductType())
51891        composeCodeableConcept(null, e);
51892      closeArray();
51893    }
51894    ;
51895    if (element.hasMonograph()) {
51896      openArray("monograph");
51897      for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph())
51898        composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
51899      closeArray();
51900    }
51901    ;
51902    if (element.hasIngredient()) {
51903      openArray("ingredient");
51904      for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient())
51905        composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
51906      closeArray();
51907    }
51908    ;
51909    if (element.hasPreparationInstructionElement()) {
51910      composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
51911      composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
51912    }
51913    if (element.hasIntendedRoute()) {
51914      openArray("intendedRoute");
51915      for (CodeableConcept e : element.getIntendedRoute())
51916        composeCodeableConcept(null, e);
51917      closeArray();
51918    }
51919    ;
51920    if (element.hasCost()) {
51921      openArray("cost");
51922      for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost())
51923        composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
51924      closeArray();
51925    }
51926    ;
51927    if (element.hasMonitoringProgram()) {
51928      openArray("monitoringProgram");
51929      for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram())
51930        composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
51931      closeArray();
51932    }
51933    ;
51934    if (element.hasAdministrationGuidelines()) {
51935      openArray("administrationGuidelines");
51936      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element
51937          .getAdministrationGuidelines())
51938        composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
51939      closeArray();
51940    }
51941    ;
51942    if (element.hasMedicineClassification()) {
51943      openArray("medicineClassification");
51944      for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element
51945          .getMedicineClassification())
51946        composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
51947      closeArray();
51948    }
51949    ;
51950    if (element.hasPackaging()) {
51951      composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
51952    }
51953    if (element.hasDrugCharacteristic()) {
51954      openArray("drugCharacteristic");
51955      for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic())
51956        composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
51957      closeArray();
51958    }
51959    ;
51960    if (element.hasContraindication()) {
51961      openArray("contraindication");
51962      for (Reference e : element.getContraindication())
51963        composeReference(null, e);
51964      closeArray();
51965    }
51966    ;
51967    if (element.hasRegulatory()) {
51968      openArray("regulatory");
51969      for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory())
51970        composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(null, e);
51971      closeArray();
51972    }
51973    ;
51974    if (element.hasKinetics()) {
51975      openArray("kinetics");
51976      for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics())
51977        composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(null, e);
51978      closeArray();
51979    }
51980    ;
51981  }
51982
51983  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name,
51984      MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
51985    if (element != null) {
51986      open(name);
51987      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(element);
51988      close();
51989    }
51990  }
51991
51992  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(
51993      MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
51994    composeBackbone(element);
51995    if (element.hasType()) {
51996      composeCodeableConcept("type", element.getType());
51997    }
51998    if (element.hasReference()) {
51999      openArray("reference");
52000      for (Reference e : element.getReference())
52001        composeReference(null, e);
52002      closeArray();
52003    }
52004    ;
52005  }
52006
52007  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name,
52008      MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
52009    if (element != null) {
52010      open(name);
52011      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
52012      close();
52013    }
52014  }
52015
52016  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(
52017      MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
52018    composeBackbone(element);
52019    if (element.hasType()) {
52020      composeCodeableConcept("type", element.getType());
52021    }
52022    if (element.hasSource()) {
52023      composeReference("source", element.getSource());
52024    }
52025  }
52026
52027  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name,
52028      MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
52029    if (element != null) {
52030      open(name);
52031      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
52032      close();
52033    }
52034  }
52035
52036  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(
52037      MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
52038    composeBackbone(element);
52039    if (element.hasItem()) {
52040      composeType("item", element.getItem());
52041    }
52042    if (element.hasIsActiveElement()) {
52043      composeBooleanCore("isActive", element.getIsActiveElement(), false);
52044      composeBooleanExtras("isActive", element.getIsActiveElement(), false);
52045    }
52046    if (element.hasStrength()) {
52047      composeRatio("strength", element.getStrength());
52048    }
52049  }
52050
52051  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name,
52052      MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
52053    if (element != null) {
52054      open(name);
52055      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
52056      close();
52057    }
52058  }
52059
52060  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(
52061      MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
52062    composeBackbone(element);
52063    if (element.hasType()) {
52064      composeCodeableConcept("type", element.getType());
52065    }
52066    if (element.hasSourceElement()) {
52067      composeStringCore("source", element.getSourceElement(), false);
52068      composeStringExtras("source", element.getSourceElement(), false);
52069    }
52070    if (element.hasCost()) {
52071      composeMoney("cost", element.getCost());
52072    }
52073  }
52074
52075  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name,
52076      MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
52077    if (element != null) {
52078      open(name);
52079      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
52080      close();
52081    }
52082  }
52083
52084  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(
52085      MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
52086    composeBackbone(element);
52087    if (element.hasType()) {
52088      composeCodeableConcept("type", element.getType());
52089    }
52090    if (element.hasNameElement()) {
52091      composeStringCore("name", element.getNameElement(), false);
52092      composeStringExtras("name", element.getNameElement(), false);
52093    }
52094  }
52095
52096  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name,
52097      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
52098    if (element != null) {
52099      open(name);
52100      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(element);
52101      close();
52102    }
52103  }
52104
52105  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(
52106      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
52107    composeBackbone(element);
52108    if (element.hasDosage()) {
52109      openArray("dosage");
52110      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage())
52111        composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(null, e);
52112      closeArray();
52113    }
52114    ;
52115    if (element.hasIndication()) {
52116      composeType("indication", element.getIndication());
52117    }
52118    if (element.hasPatientCharacteristics()) {
52119      openArray("patientCharacteristics");
52120      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element
52121          .getPatientCharacteristics())
52122        composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
52123      closeArray();
52124    }
52125    ;
52126  }
52127
52128  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name,
52129      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
52130    if (element != null) {
52131      open(name);
52132      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(element);
52133      close();
52134    }
52135  }
52136
52137  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(
52138      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
52139    composeBackbone(element);
52140    if (element.hasType()) {
52141      composeCodeableConcept("type", element.getType());
52142    }
52143    if (element.hasDosage()) {
52144      openArray("dosage");
52145      for (Dosage e : element.getDosage())
52146        composeDosage(null, e);
52147      closeArray();
52148    }
52149    ;
52150  }
52151
52152  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(
52153      String name,
52154      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element)
52155      throws IOException {
52156    if (element != null) {
52157      open(name);
52158      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(
52159          element);
52160      close();
52161    }
52162  }
52163
52164  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(
52165      MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element)
52166      throws IOException {
52167    composeBackbone(element);
52168    if (element.hasCharacteristic()) {
52169      composeType("characteristic", element.getCharacteristic());
52170    }
52171    if (element.hasValue()) {
52172      openArray("value");
52173      for (StringType e : element.getValue())
52174        composeStringCore(null, e, true);
52175      closeArray();
52176      if (anyHasExtras(element.getValue())) {
52177        openArray("_value");
52178        for (StringType e : element.getValue())
52179          composeStringExtras(null, e, true);
52180        closeArray();
52181      }
52182    }
52183    ;
52184  }
52185
52186  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name,
52187      MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
52188    if (element != null) {
52189      open(name);
52190      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
52191      close();
52192    }
52193  }
52194
52195  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(
52196      MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
52197    composeBackbone(element);
52198    if (element.hasType()) {
52199      composeCodeableConcept("type", element.getType());
52200    }
52201    if (element.hasClassification()) {
52202      openArray("classification");
52203      for (CodeableConcept e : element.getClassification())
52204        composeCodeableConcept(null, e);
52205      closeArray();
52206    }
52207    ;
52208  }
52209
52210  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name,
52211      MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
52212    if (element != null) {
52213      open(name);
52214      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
52215      close();
52216    }
52217  }
52218
52219  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(
52220      MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
52221    composeBackbone(element);
52222    if (element.hasType()) {
52223      composeCodeableConcept("type", element.getType());
52224    }
52225    if (element.hasQuantity()) {
52226      composeQuantity("quantity", element.getQuantity());
52227    }
52228  }
52229
52230  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name,
52231      MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
52232    if (element != null) {
52233      open(name);
52234      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
52235      close();
52236    }
52237  }
52238
52239  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(
52240      MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
52241    composeBackbone(element);
52242    if (element.hasType()) {
52243      composeCodeableConcept("type", element.getType());
52244    }
52245    if (element.hasValue()) {
52246      composeType("value", element.getValue());
52247    }
52248  }
52249
52250  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name,
52251      MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
52252    if (element != null) {
52253      open(name);
52254      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(element);
52255      close();
52256    }
52257  }
52258
52259  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(
52260      MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
52261    composeBackbone(element);
52262    if (element.hasRegulatoryAuthority()) {
52263      composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
52264    }
52265    if (element.hasSubstitution()) {
52266      openArray("substitution");
52267      for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution())
52268        composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
52269      closeArray();
52270    }
52271    ;
52272    if (element.hasSchedule()) {
52273      openArray("schedule");
52274      for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule())
52275        composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(null, e);
52276      closeArray();
52277    }
52278    ;
52279    if (element.hasMaxDispense()) {
52280      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense",
52281          element.getMaxDispense());
52282    }
52283  }
52284
52285  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name,
52286      MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
52287    if (element != null) {
52288      open(name);
52289      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(element);
52290      close();
52291    }
52292  }
52293
52294  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(
52295      MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
52296    composeBackbone(element);
52297    if (element.hasType()) {
52298      composeCodeableConcept("type", element.getType());
52299    }
52300    if (element.hasAllowedElement()) {
52301      composeBooleanCore("allowed", element.getAllowedElement(), false);
52302      composeBooleanExtras("allowed", element.getAllowedElement(), false);
52303    }
52304  }
52305
52306  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(String name,
52307      MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
52308    if (element != null) {
52309      open(name);
52310      composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(element);
52311      close();
52312    }
52313  }
52314
52315  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(
52316      MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
52317    composeBackbone(element);
52318    if (element.hasSchedule()) {
52319      composeCodeableConcept("schedule", element.getSchedule());
52320    }
52321  }
52322
52323  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name,
52324      MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
52325    if (element != null) {
52326      open(name);
52327      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(element);
52328      close();
52329    }
52330  }
52331
52332  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(
52333      MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
52334    composeBackbone(element);
52335    if (element.hasQuantity()) {
52336      composeQuantity("quantity", element.getQuantity());
52337    }
52338    if (element.hasPeriod()) {
52339      composeDuration("period", element.getPeriod());
52340    }
52341  }
52342
52343  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(String name,
52344      MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
52345    if (element != null) {
52346      open(name);
52347      composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(element);
52348      close();
52349    }
52350  }
52351
52352  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(
52353      MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
52354    composeBackbone(element);
52355    if (element.hasAreaUnderCurve()) {
52356      openArray("areaUnderCurve");
52357      for (Quantity e : element.getAreaUnderCurve())
52358        composeQuantity(null, e);
52359      closeArray();
52360    }
52361    ;
52362    if (element.hasLethalDose50()) {
52363      openArray("lethalDose50");
52364      for (Quantity e : element.getLethalDose50())
52365        composeQuantity(null, e);
52366      closeArray();
52367    }
52368    ;
52369    if (element.hasHalfLifePeriod()) {
52370      composeDuration("halfLifePeriod", element.getHalfLifePeriod());
52371    }
52372  }
52373
52374  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
52375    if (element != null) {
52376      prop("resourceType", name);
52377      composeMedicationRequestInner(element);
52378    }
52379  }
52380
52381  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
52382    composeDomainResourceElements(element);
52383    if (element.hasIdentifier()) {
52384      openArray("identifier");
52385      for (Identifier e : element.getIdentifier())
52386        composeIdentifier(null, e);
52387      closeArray();
52388    }
52389    ;
52390    if (element.hasStatusElement()) {
52391      composeEnumerationCore("status", element.getStatusElement(),
52392          new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
52393      composeEnumerationExtras("status", element.getStatusElement(),
52394          new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
52395    }
52396    if (element.hasStatusReason()) {
52397      composeCodeableConcept("statusReason", element.getStatusReason());
52398    }
52399    if (element.hasIntentElement()) {
52400      composeEnumerationCore("intent", element.getIntentElement(),
52401          new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
52402      composeEnumerationExtras("intent", element.getIntentElement(),
52403          new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
52404    }
52405    if (element.hasCategory()) {
52406      openArray("category");
52407      for (CodeableConcept e : element.getCategory())
52408        composeCodeableConcept(null, e);
52409      closeArray();
52410    }
52411    ;
52412    if (element.hasPriorityElement()) {
52413      composeEnumerationCore("priority", element.getPriorityElement(),
52414          new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
52415      composeEnumerationExtras("priority", element.getPriorityElement(),
52416          new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
52417    }
52418    if (element.hasDoNotPerformElement()) {
52419      composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
52420      composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
52421    }
52422    if (element.hasReported()) {
52423      composeType("reported", element.getReported());
52424    }
52425    if (element.hasMedication()) {
52426      composeType("medication", element.getMedication());
52427    }
52428    if (element.hasSubject()) {
52429      composeReference("subject", element.getSubject());
52430    }
52431    if (element.hasEncounter()) {
52432      composeReference("encounter", element.getEncounter());
52433    }
52434    if (element.hasSupportingInformation()) {
52435      openArray("supportingInformation");
52436      for (Reference e : element.getSupportingInformation())
52437        composeReference(null, e);
52438      closeArray();
52439    }
52440    ;
52441    if (element.hasAuthoredOnElement()) {
52442      composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
52443      composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
52444    }
52445    if (element.hasRequester()) {
52446      composeReference("requester", element.getRequester());
52447    }
52448    if (element.hasPerformer()) {
52449      composeReference("performer", element.getPerformer());
52450    }
52451    if (element.hasPerformerType()) {
52452      composeCodeableConcept("performerType", element.getPerformerType());
52453    }
52454    if (element.hasRecorder()) {
52455      composeReference("recorder", element.getRecorder());
52456    }
52457    if (element.hasReasonCode()) {
52458      openArray("reasonCode");
52459      for (CodeableConcept e : element.getReasonCode())
52460        composeCodeableConcept(null, e);
52461      closeArray();
52462    }
52463    ;
52464    if (element.hasReasonReference()) {
52465      openArray("reasonReference");
52466      for (Reference e : element.getReasonReference())
52467        composeReference(null, e);
52468      closeArray();
52469    }
52470    ;
52471    if (element.hasInstantiatesCanonical()) {
52472      openArray("instantiatesCanonical");
52473      for (CanonicalType e : element.getInstantiatesCanonical())
52474        composeCanonicalCore(null, e, true);
52475      closeArray();
52476      if (anyHasExtras(element.getInstantiatesCanonical())) {
52477        openArray("_instantiatesCanonical");
52478        for (CanonicalType e : element.getInstantiatesCanonical())
52479          composeCanonicalExtras(null, e, true);
52480        closeArray();
52481      }
52482    }
52483    ;
52484    if (element.hasInstantiatesUri()) {
52485      openArray("instantiatesUri");
52486      for (UriType e : element.getInstantiatesUri())
52487        composeUriCore(null, e, true);
52488      closeArray();
52489      if (anyHasExtras(element.getInstantiatesUri())) {
52490        openArray("_instantiatesUri");
52491        for (UriType e : element.getInstantiatesUri())
52492          composeUriExtras(null, e, true);
52493        closeArray();
52494      }
52495    }
52496    ;
52497    if (element.hasBasedOn()) {
52498      openArray("basedOn");
52499      for (Reference e : element.getBasedOn())
52500        composeReference(null, e);
52501      closeArray();
52502    }
52503    ;
52504    if (element.hasGroupIdentifier()) {
52505      composeIdentifier("groupIdentifier", element.getGroupIdentifier());
52506    }
52507    if (element.hasCourseOfTherapyType()) {
52508      composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
52509    }
52510    if (element.hasInsurance()) {
52511      openArray("insurance");
52512      for (Reference e : element.getInsurance())
52513        composeReference(null, e);
52514      closeArray();
52515    }
52516    ;
52517    if (element.hasNote()) {
52518      openArray("note");
52519      for (Annotation e : element.getNote())
52520        composeAnnotation(null, e);
52521      closeArray();
52522    }
52523    ;
52524    if (element.hasDosageInstruction()) {
52525      openArray("dosageInstruction");
52526      for (Dosage e : element.getDosageInstruction())
52527        composeDosage(null, e);
52528      closeArray();
52529    }
52530    ;
52531    if (element.hasDispenseRequest()) {
52532      composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest",
52533          element.getDispenseRequest());
52534    }
52535    if (element.hasSubstitution()) {
52536      composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
52537    }
52538    if (element.hasPriorPrescription()) {
52539      composeReference("priorPrescription", element.getPriorPrescription());
52540    }
52541    if (element.hasDetectedIssue()) {
52542      openArray("detectedIssue");
52543      for (Reference e : element.getDetectedIssue())
52544        composeReference(null, e);
52545      closeArray();
52546    }
52547    ;
52548    if (element.hasEventHistory()) {
52549      openArray("eventHistory");
52550      for (Reference e : element.getEventHistory())
52551        composeReference(null, e);
52552      closeArray();
52553    }
52554    ;
52555  }
52556
52557  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name,
52558      MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
52559    if (element != null) {
52560      open(name);
52561      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
52562      close();
52563    }
52564  }
52565
52566  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(
52567      MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
52568    composeBackbone(element);
52569    if (element.hasInitialFill()) {
52570      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill",
52571          element.getInitialFill());
52572    }
52573    if (element.hasDispenseInterval()) {
52574      composeDuration("dispenseInterval", element.getDispenseInterval());
52575    }
52576    if (element.hasValidityPeriod()) {
52577      composePeriod("validityPeriod", element.getValidityPeriod());
52578    }
52579    if (element.hasNumberOfRepeatsAllowedElement()) {
52580      composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
52581      composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
52582    }
52583    if (element.hasQuantity()) {
52584      composeQuantity("quantity", element.getQuantity());
52585    }
52586    if (element.hasExpectedSupplyDuration()) {
52587      composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
52588    }
52589    if (element.hasPerformer()) {
52590      composeReference("performer", element.getPerformer());
52591    }
52592  }
52593
52594  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name,
52595      MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
52596    if (element != null) {
52597      open(name);
52598      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(element);
52599      close();
52600    }
52601  }
52602
52603  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(
52604      MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
52605    composeBackbone(element);
52606    if (element.hasQuantity()) {
52607      composeQuantity("quantity", element.getQuantity());
52608    }
52609    if (element.hasDuration()) {
52610      composeDuration("duration", element.getDuration());
52611    }
52612  }
52613
52614  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name,
52615      MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
52616    if (element != null) {
52617      open(name);
52618      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
52619      close();
52620    }
52621  }
52622
52623  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(
52624      MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
52625    composeBackbone(element);
52626    if (element.hasAllowed()) {
52627      composeType("allowed", element.getAllowed());
52628    }
52629    if (element.hasReason()) {
52630      composeCodeableConcept("reason", element.getReason());
52631    }
52632  }
52633
52634  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
52635    if (element != null) {
52636      prop("resourceType", name);
52637      composeMedicationStatementInner(element);
52638    }
52639  }
52640
52641  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
52642    composeDomainResourceElements(element);
52643    if (element.hasIdentifier()) {
52644      openArray("identifier");
52645      for (Identifier e : element.getIdentifier())
52646        composeIdentifier(null, e);
52647      closeArray();
52648    }
52649    ;
52650    if (element.hasBasedOn()) {
52651      openArray("basedOn");
52652      for (Reference e : element.getBasedOn())
52653        composeReference(null, e);
52654      closeArray();
52655    }
52656    ;
52657    if (element.hasPartOf()) {
52658      openArray("partOf");
52659      for (Reference e : element.getPartOf())
52660        composeReference(null, e);
52661      closeArray();
52662    }
52663    ;
52664    if (element.hasStatusElement()) {
52665      composeEnumerationCore("status", element.getStatusElement(),
52666          new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
52667      composeEnumerationExtras("status", element.getStatusElement(),
52668          new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
52669    }
52670    if (element.hasStatusReason()) {
52671      openArray("statusReason");
52672      for (CodeableConcept e : element.getStatusReason())
52673        composeCodeableConcept(null, e);
52674      closeArray();
52675    }
52676    ;
52677    if (element.hasCategory()) {
52678      composeCodeableConcept("category", element.getCategory());
52679    }
52680    if (element.hasMedication()) {
52681      composeType("medication", element.getMedication());
52682    }
52683    if (element.hasSubject()) {
52684      composeReference("subject", element.getSubject());
52685    }
52686    if (element.hasContext()) {
52687      composeReference("context", element.getContext());
52688    }
52689    if (element.hasEffective()) {
52690      composeType("effective", element.getEffective());
52691    }
52692    if (element.hasDateAssertedElement()) {
52693      composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
52694      composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
52695    }
52696    if (element.hasInformationSource()) {
52697      composeReference("informationSource", element.getInformationSource());
52698    }
52699    if (element.hasDerivedFrom()) {
52700      openArray("derivedFrom");
52701      for (Reference e : element.getDerivedFrom())
52702        composeReference(null, e);
52703      closeArray();
52704    }
52705    ;
52706    if (element.hasReasonCode()) {
52707      openArray("reasonCode");
52708      for (CodeableConcept e : element.getReasonCode())
52709        composeCodeableConcept(null, e);
52710      closeArray();
52711    }
52712    ;
52713    if (element.hasReasonReference()) {
52714      openArray("reasonReference");
52715      for (Reference e : element.getReasonReference())
52716        composeReference(null, e);
52717      closeArray();
52718    }
52719    ;
52720    if (element.hasNote()) {
52721      openArray("note");
52722      for (Annotation e : element.getNote())
52723        composeAnnotation(null, e);
52724      closeArray();
52725    }
52726    ;
52727    if (element.hasDosage()) {
52728      openArray("dosage");
52729      for (Dosage e : element.getDosage())
52730        composeDosage(null, e);
52731      closeArray();
52732    }
52733    ;
52734  }
52735
52736  protected void composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
52737    if (element != null) {
52738      prop("resourceType", name);
52739      composeMedicinalProductInner(element);
52740    }
52741  }
52742
52743  protected void composeMedicinalProductInner(MedicinalProduct element) throws IOException {
52744    composeDomainResourceElements(element);
52745    if (element.hasIdentifier()) {
52746      openArray("identifier");
52747      for (Identifier e : element.getIdentifier())
52748        composeIdentifier(null, e);
52749      closeArray();
52750    }
52751    ;
52752    if (element.hasType()) {
52753      composeCodeableConcept("type", element.getType());
52754    }
52755    if (element.hasDomain()) {
52756      composeCoding("domain", element.getDomain());
52757    }
52758    if (element.hasCombinedPharmaceuticalDoseForm()) {
52759      composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
52760    }
52761    if (element.hasLegalStatusOfSupply()) {
52762      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
52763    }
52764    if (element.hasAdditionalMonitoringIndicator()) {
52765      composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
52766    }
52767    if (element.hasSpecialMeasures()) {
52768      openArray("specialMeasures");
52769      for (StringType e : element.getSpecialMeasures())
52770        composeStringCore(null, e, true);
52771      closeArray();
52772      if (anyHasExtras(element.getSpecialMeasures())) {
52773        openArray("_specialMeasures");
52774        for (StringType e : element.getSpecialMeasures())
52775          composeStringExtras(null, e, true);
52776        closeArray();
52777      }
52778    }
52779    ;
52780    if (element.hasPaediatricUseIndicator()) {
52781      composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
52782    }
52783    if (element.hasProductClassification()) {
52784      openArray("productClassification");
52785      for (CodeableConcept e : element.getProductClassification())
52786        composeCodeableConcept(null, e);
52787      closeArray();
52788    }
52789    ;
52790    if (element.hasMarketingStatus()) {
52791      openArray("marketingStatus");
52792      for (MarketingStatus e : element.getMarketingStatus())
52793        composeMarketingStatus(null, e);
52794      closeArray();
52795    }
52796    ;
52797    if (element.hasPharmaceuticalProduct()) {
52798      openArray("pharmaceuticalProduct");
52799      for (Reference e : element.getPharmaceuticalProduct())
52800        composeReference(null, e);
52801      closeArray();
52802    }
52803    ;
52804    if (element.hasPackagedMedicinalProduct()) {
52805      openArray("packagedMedicinalProduct");
52806      for (Reference e : element.getPackagedMedicinalProduct())
52807        composeReference(null, e);
52808      closeArray();
52809    }
52810    ;
52811    if (element.hasAttachedDocument()) {
52812      openArray("attachedDocument");
52813      for (Reference e : element.getAttachedDocument())
52814        composeReference(null, e);
52815      closeArray();
52816    }
52817    ;
52818    if (element.hasMasterFile()) {
52819      openArray("masterFile");
52820      for (Reference e : element.getMasterFile())
52821        composeReference(null, e);
52822      closeArray();
52823    }
52824    ;
52825    if (element.hasContact()) {
52826      openArray("contact");
52827      for (Reference e : element.getContact())
52828        composeReference(null, e);
52829      closeArray();
52830    }
52831    ;
52832    if (element.hasClinicalTrial()) {
52833      openArray("clinicalTrial");
52834      for (Reference e : element.getClinicalTrial())
52835        composeReference(null, e);
52836      closeArray();
52837    }
52838    ;
52839    if (element.hasName()) {
52840      openArray("name");
52841      for (MedicinalProduct.MedicinalProductNameComponent e : element.getName())
52842        composeMedicinalProductMedicinalProductNameComponent(null, e);
52843      closeArray();
52844    }
52845    ;
52846    if (element.hasCrossReference()) {
52847      openArray("crossReference");
52848      for (Identifier e : element.getCrossReference())
52849        composeIdentifier(null, e);
52850      closeArray();
52851    }
52852    ;
52853    if (element.hasManufacturingBusinessOperation()) {
52854      openArray("manufacturingBusinessOperation");
52855      for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element
52856          .getManufacturingBusinessOperation())
52857        composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(null, e);
52858      closeArray();
52859    }
52860    ;
52861    if (element.hasSpecialDesignation()) {
52862      openArray("specialDesignation");
52863      for (MedicinalProduct.MedicinalProductSpecialDesignationComponent e : element.getSpecialDesignation())
52864        composeMedicinalProductMedicinalProductSpecialDesignationComponent(null, e);
52865      closeArray();
52866    }
52867    ;
52868  }
52869
52870  protected void composeMedicinalProductMedicinalProductNameComponent(String name,
52871      MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
52872    if (element != null) {
52873      open(name);
52874      composeMedicinalProductMedicinalProductNameComponentInner(element);
52875      close();
52876    }
52877  }
52878
52879  protected void composeMedicinalProductMedicinalProductNameComponentInner(
52880      MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
52881    composeBackbone(element);
52882    if (element.hasProductNameElement()) {
52883      composeStringCore("productName", element.getProductNameElement(), false);
52884      composeStringExtras("productName", element.getProductNameElement(), false);
52885    }
52886    if (element.hasNamePart()) {
52887      openArray("namePart");
52888      for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart())
52889        composeMedicinalProductMedicinalProductNameNamePartComponent(null, e);
52890      closeArray();
52891    }
52892    ;
52893    if (element.hasCountryLanguage()) {
52894      openArray("countryLanguage");
52895      for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage())
52896        composeMedicinalProductMedicinalProductNameCountryLanguageComponent(null, e);
52897      closeArray();
52898    }
52899    ;
52900  }
52901
52902  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name,
52903      MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
52904    if (element != null) {
52905      open(name);
52906      composeMedicinalProductMedicinalProductNameNamePartComponentInner(element);
52907      close();
52908    }
52909  }
52910
52911  protected void composeMedicinalProductMedicinalProductNameNamePartComponentInner(
52912      MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
52913    composeBackbone(element);
52914    if (element.hasPartElement()) {
52915      composeStringCore("part", element.getPartElement(), false);
52916      composeStringExtras("part", element.getPartElement(), false);
52917    }
52918    if (element.hasType()) {
52919      composeCoding("type", element.getType());
52920    }
52921  }
52922
52923  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name,
52924      MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
52925    if (element != null) {
52926      open(name);
52927      composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(element);
52928      close();
52929    }
52930  }
52931
52932  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(
52933      MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
52934    composeBackbone(element);
52935    if (element.hasCountry()) {
52936      composeCodeableConcept("country", element.getCountry());
52937    }
52938    if (element.hasJurisdiction()) {
52939      composeCodeableConcept("jurisdiction", element.getJurisdiction());
52940    }
52941    if (element.hasLanguage()) {
52942      composeCodeableConcept("language", element.getLanguage());
52943    }
52944  }
52945
52946  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name,
52947      MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
52948    if (element != null) {
52949      open(name);
52950      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(element);
52951      close();
52952    }
52953  }
52954
52955  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(
52956      MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
52957    composeBackbone(element);
52958    if (element.hasOperationType()) {
52959      composeCodeableConcept("operationType", element.getOperationType());
52960    }
52961    if (element.hasAuthorisationReferenceNumber()) {
52962      composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
52963    }
52964    if (element.hasEffectiveDateElement()) {
52965      composeDateTimeCore("effectiveDate", element.getEffectiveDateElement(), false);
52966      composeDateTimeExtras("effectiveDate", element.getEffectiveDateElement(), false);
52967    }
52968    if (element.hasConfidentialityIndicator()) {
52969      composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
52970    }
52971    if (element.hasManufacturer()) {
52972      openArray("manufacturer");
52973      for (Reference e : element.getManufacturer())
52974        composeReference(null, e);
52975      closeArray();
52976    }
52977    ;
52978    if (element.hasRegulator()) {
52979      composeReference("regulator", element.getRegulator());
52980    }
52981  }
52982
52983  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponent(String name,
52984      MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
52985    if (element != null) {
52986      open(name);
52987      composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(element);
52988      close();
52989    }
52990  }
52991
52992  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(
52993      MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
52994    composeBackbone(element);
52995    if (element.hasIdentifier()) {
52996      openArray("identifier");
52997      for (Identifier e : element.getIdentifier())
52998        composeIdentifier(null, e);
52999      closeArray();
53000    }
53001    ;
53002    if (element.hasType()) {
53003      composeCodeableConcept("type", element.getType());
53004    }
53005    if (element.hasIntendedUse()) {
53006      composeCodeableConcept("intendedUse", element.getIntendedUse());
53007    }
53008    if (element.hasIndication()) {
53009      composeType("indication", element.getIndication());
53010    }
53011    if (element.hasStatus()) {
53012      composeCodeableConcept("status", element.getStatus());
53013    }
53014    if (element.hasDateElement()) {
53015      composeDateTimeCore("date", element.getDateElement(), false);
53016      composeDateTimeExtras("date", element.getDateElement(), false);
53017    }
53018    if (element.hasSpecies()) {
53019      composeCodeableConcept("species", element.getSpecies());
53020    }
53021  }
53022
53023  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element)
53024      throws IOException {
53025    if (element != null) {
53026      prop("resourceType", name);
53027      composeMedicinalProductAuthorizationInner(element);
53028    }
53029  }
53030
53031  protected void composeMedicinalProductAuthorizationInner(MedicinalProductAuthorization element) throws IOException {
53032    composeDomainResourceElements(element);
53033    if (element.hasIdentifier()) {
53034      openArray("identifier");
53035      for (Identifier e : element.getIdentifier())
53036        composeIdentifier(null, e);
53037      closeArray();
53038    }
53039    ;
53040    if (element.hasSubject()) {
53041      composeReference("subject", element.getSubject());
53042    }
53043    if (element.hasCountry()) {
53044      openArray("country");
53045      for (CodeableConcept e : element.getCountry())
53046        composeCodeableConcept(null, e);
53047      closeArray();
53048    }
53049    ;
53050    if (element.hasJurisdiction()) {
53051      openArray("jurisdiction");
53052      for (CodeableConcept e : element.getJurisdiction())
53053        composeCodeableConcept(null, e);
53054      closeArray();
53055    }
53056    ;
53057    if (element.hasStatus()) {
53058      composeCodeableConcept("status", element.getStatus());
53059    }
53060    if (element.hasStatusDateElement()) {
53061      composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
53062      composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
53063    }
53064    if (element.hasRestoreDateElement()) {
53065      composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
53066      composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
53067    }
53068    if (element.hasValidityPeriod()) {
53069      composePeriod("validityPeriod", element.getValidityPeriod());
53070    }
53071    if (element.hasDataExclusivityPeriod()) {
53072      composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
53073    }
53074    if (element.hasDateOfFirstAuthorizationElement()) {
53075      composeDateTimeCore("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
53076      composeDateTimeExtras("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
53077    }
53078    if (element.hasInternationalBirthDateElement()) {
53079      composeDateTimeCore("internationalBirthDate", element.getInternationalBirthDateElement(), false);
53080      composeDateTimeExtras("internationalBirthDate", element.getInternationalBirthDateElement(), false);
53081    }
53082    if (element.hasLegalBasis()) {
53083      composeCodeableConcept("legalBasis", element.getLegalBasis());
53084    }
53085    if (element.hasJurisdictionalAuthorization()) {
53086      openArray("jurisdictionalAuthorization");
53087      for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element
53088          .getJurisdictionalAuthorization())
53089        composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(null, e);
53090      closeArray();
53091    }
53092    ;
53093    if (element.hasHolder()) {
53094      composeReference("holder", element.getHolder());
53095    }
53096    if (element.hasRegulator()) {
53097      composeReference("regulator", element.getRegulator());
53098    }
53099    if (element.hasProcedure()) {
53100      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure",
53101          element.getProcedure());
53102    }
53103  }
53104
53105  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(
53106      String name,
53107      MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element)
53108      throws IOException {
53109    if (element != null) {
53110      open(name);
53111      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(
53112          element);
53113      close();
53114    }
53115  }
53116
53117  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(
53118      MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element)
53119      throws IOException {
53120    composeBackbone(element);
53121    if (element.hasIdentifier()) {
53122      openArray("identifier");
53123      for (Identifier e : element.getIdentifier())
53124        composeIdentifier(null, e);
53125      closeArray();
53126    }
53127    ;
53128    if (element.hasCountry()) {
53129      composeCodeableConcept("country", element.getCountry());
53130    }
53131    if (element.hasJurisdiction()) {
53132      openArray("jurisdiction");
53133      for (CodeableConcept e : element.getJurisdiction())
53134        composeCodeableConcept(null, e);
53135      closeArray();
53136    }
53137    ;
53138    if (element.hasLegalStatusOfSupply()) {
53139      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
53140    }
53141    if (element.hasValidityPeriod()) {
53142      composePeriod("validityPeriod", element.getValidityPeriod());
53143    }
53144  }
53145
53146  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name,
53147      MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
53148    if (element != null) {
53149      open(name);
53150      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(element);
53151      close();
53152    }
53153  }
53154
53155  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(
53156      MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
53157    composeBackbone(element);
53158    if (element.hasIdentifier()) {
53159      composeIdentifier("identifier", element.getIdentifier());
53160    }
53161    if (element.hasType()) {
53162      composeCodeableConcept("type", element.getType());
53163    }
53164    if (element.hasDate()) {
53165      composeType("date", element.getDate());
53166    }
53167    if (element.hasApplication()) {
53168      openArray("application");
53169      for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent e : element.getApplication())
53170        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(null, e);
53171      closeArray();
53172    }
53173    ;
53174  }
53175
53176  protected void composeMedicinalProductContraindication(String name, MedicinalProductContraindication element)
53177      throws IOException {
53178    if (element != null) {
53179      prop("resourceType", name);
53180      composeMedicinalProductContraindicationInner(element);
53181    }
53182  }
53183
53184  protected void composeMedicinalProductContraindicationInner(MedicinalProductContraindication element)
53185      throws IOException {
53186    composeDomainResourceElements(element);
53187    if (element.hasSubject()) {
53188      openArray("subject");
53189      for (Reference e : element.getSubject())
53190        composeReference(null, e);
53191      closeArray();
53192    }
53193    ;
53194    if (element.hasDisease()) {
53195      composeCodeableConcept("disease", element.getDisease());
53196    }
53197    if (element.hasDiseaseStatus()) {
53198      composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
53199    }
53200    if (element.hasComorbidity()) {
53201      openArray("comorbidity");
53202      for (CodeableConcept e : element.getComorbidity())
53203        composeCodeableConcept(null, e);
53204      closeArray();
53205    }
53206    ;
53207    if (element.hasTherapeuticIndication()) {
53208      openArray("therapeuticIndication");
53209      for (Reference e : element.getTherapeuticIndication())
53210        composeReference(null, e);
53211      closeArray();
53212    }
53213    ;
53214    if (element.hasOtherTherapy()) {
53215      openArray("otherTherapy");
53216      for (MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent e : element
53217          .getOtherTherapy())
53218        composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(null, e);
53219      closeArray();
53220    }
53221    ;
53222    if (element.hasPopulation()) {
53223      openArray("population");
53224      for (Population e : element.getPopulation())
53225        composePopulation(null, e);
53226      closeArray();
53227    }
53228    ;
53229  }
53230
53231  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(
53232      String name, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element)
53233      throws IOException {
53234    if (element != null) {
53235      open(name);
53236      composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(element);
53237      close();
53238    }
53239  }
53240
53241  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(
53242      MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element)
53243      throws IOException {
53244    composeBackbone(element);
53245    if (element.hasTherapyRelationshipType()) {
53246      composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
53247    }
53248    if (element.hasMedication()) {
53249      composeType("medication", element.getMedication());
53250    }
53251  }
53252
53253  protected void composeMedicinalProductIndication(String name, MedicinalProductIndication element) throws IOException {
53254    if (element != null) {
53255      prop("resourceType", name);
53256      composeMedicinalProductIndicationInner(element);
53257    }
53258  }
53259
53260  protected void composeMedicinalProductIndicationInner(MedicinalProductIndication element) throws IOException {
53261    composeDomainResourceElements(element);
53262    if (element.hasSubject()) {
53263      openArray("subject");
53264      for (Reference e : element.getSubject())
53265        composeReference(null, e);
53266      closeArray();
53267    }
53268    ;
53269    if (element.hasDiseaseSymptomProcedure()) {
53270      composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
53271    }
53272    if (element.hasDiseaseStatus()) {
53273      composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
53274    }
53275    if (element.hasComorbidity()) {
53276      openArray("comorbidity");
53277      for (CodeableConcept e : element.getComorbidity())
53278        composeCodeableConcept(null, e);
53279      closeArray();
53280    }
53281    ;
53282    if (element.hasIntendedEffect()) {
53283      composeCodeableConcept("intendedEffect", element.getIntendedEffect());
53284    }
53285    if (element.hasDuration()) {
53286      composeQuantity("duration", element.getDuration());
53287    }
53288    if (element.hasOtherTherapy()) {
53289      openArray("otherTherapy");
53290      for (MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent e : element.getOtherTherapy())
53291        composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(null, e);
53292      closeArray();
53293    }
53294    ;
53295    if (element.hasUndesirableEffect()) {
53296      openArray("undesirableEffect");
53297      for (Reference e : element.getUndesirableEffect())
53298        composeReference(null, e);
53299      closeArray();
53300    }
53301    ;
53302    if (element.hasPopulation()) {
53303      openArray("population");
53304      for (Population e : element.getPopulation())
53305        composePopulation(null, e);
53306      closeArray();
53307    }
53308    ;
53309  }
53310
53311  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(String name,
53312      MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
53313    if (element != null) {
53314      open(name);
53315      composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(element);
53316      close();
53317    }
53318  }
53319
53320  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(
53321      MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
53322    composeBackbone(element);
53323    if (element.hasTherapyRelationshipType()) {
53324      composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
53325    }
53326    if (element.hasMedication()) {
53327      composeType("medication", element.getMedication());
53328    }
53329  }
53330
53331  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
53332    if (element != null) {
53333      prop("resourceType", name);
53334      composeMedicinalProductIngredientInner(element);
53335    }
53336  }
53337
53338  protected void composeMedicinalProductIngredientInner(MedicinalProductIngredient element) throws IOException {
53339    composeDomainResourceElements(element);
53340    if (element.hasIdentifier()) {
53341      composeIdentifier("identifier", element.getIdentifier());
53342    }
53343    if (element.hasRole()) {
53344      composeCodeableConcept("role", element.getRole());
53345    }
53346    if (element.hasAllergenicIndicatorElement()) {
53347      composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
53348      composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
53349    }
53350    if (element.hasManufacturer()) {
53351      openArray("manufacturer");
53352      for (Reference e : element.getManufacturer())
53353        composeReference(null, e);
53354      closeArray();
53355    }
53356    ;
53357    if (element.hasSpecifiedSubstance()) {
53358      openArray("specifiedSubstance");
53359      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element
53360          .getSpecifiedSubstance())
53361        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(null, e);
53362      closeArray();
53363    }
53364    ;
53365    if (element.hasSubstance()) {
53366      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance",
53367          element.getSubstance());
53368    }
53369  }
53370
53371  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name,
53372      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
53373    if (element != null) {
53374      open(name);
53375      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(element);
53376      close();
53377    }
53378  }
53379
53380  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(
53381      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
53382    composeBackbone(element);
53383    if (element.hasCode()) {
53384      composeCodeableConcept("code", element.getCode());
53385    }
53386    if (element.hasGroup()) {
53387      composeCodeableConcept("group", element.getGroup());
53388    }
53389    if (element.hasConfidentiality()) {
53390      composeCodeableConcept("confidentiality", element.getConfidentiality());
53391    }
53392    if (element.hasStrength()) {
53393      openArray("strength");
53394      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element
53395          .getStrength())
53396        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
53397      closeArray();
53398    }
53399    ;
53400  }
53401
53402  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(
53403      String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element)
53404      throws IOException {
53405    if (element != null) {
53406      open(name);
53407      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(element);
53408      close();
53409    }
53410  }
53411
53412  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(
53413      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element)
53414      throws IOException {
53415    composeBackbone(element);
53416    if (element.hasPresentation()) {
53417      composeRatio("presentation", element.getPresentation());
53418    }
53419    if (element.hasPresentationLowLimit()) {
53420      composeRatio("presentationLowLimit", element.getPresentationLowLimit());
53421    }
53422    if (element.hasConcentration()) {
53423      composeRatio("concentration", element.getConcentration());
53424    }
53425    if (element.hasConcentrationLowLimit()) {
53426      composeRatio("concentrationLowLimit", element.getConcentrationLowLimit());
53427    }
53428    if (element.hasMeasurementPointElement()) {
53429      composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
53430      composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
53431    }
53432    if (element.hasCountry()) {
53433      openArray("country");
53434      for (CodeableConcept e : element.getCountry())
53435        composeCodeableConcept(null, e);
53436      closeArray();
53437    }
53438    ;
53439    if (element.hasReferenceStrength()) {
53440      openArray("referenceStrength");
53441      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element
53442          .getReferenceStrength())
53443        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
53444            null, e);
53445      closeArray();
53446    }
53447    ;
53448  }
53449
53450  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(
53451      String name,
53452      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element)
53453      throws IOException {
53454    if (element != null) {
53455      open(name);
53456      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(
53457          element);
53458      close();
53459    }
53460  }
53461
53462  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(
53463      MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element)
53464      throws IOException {
53465    composeBackbone(element);
53466    if (element.hasSubstance()) {
53467      composeCodeableConcept("substance", element.getSubstance());
53468    }
53469    if (element.hasStrength()) {
53470      composeRatio("strength", element.getStrength());
53471    }
53472    if (element.hasStrengthLowLimit()) {
53473      composeRatio("strengthLowLimit", element.getStrengthLowLimit());
53474    }
53475    if (element.hasMeasurementPointElement()) {
53476      composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
53477      composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
53478    }
53479    if (element.hasCountry()) {
53480      openArray("country");
53481      for (CodeableConcept e : element.getCountry())
53482        composeCodeableConcept(null, e);
53483      closeArray();
53484    }
53485    ;
53486  }
53487
53488  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name,
53489      MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
53490    if (element != null) {
53491      open(name);
53492      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(element);
53493      close();
53494    }
53495  }
53496
53497  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(
53498      MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
53499    composeBackbone(element);
53500    if (element.hasCode()) {
53501      composeCodeableConcept("code", element.getCode());
53502    }
53503    if (element.hasStrength()) {
53504      openArray("strength");
53505      for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element
53506          .getStrength())
53507        composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
53508      closeArray();
53509    }
53510    ;
53511  }
53512
53513  protected void composeMedicinalProductInteraction(String name, MedicinalProductInteraction element)
53514      throws IOException {
53515    if (element != null) {
53516      prop("resourceType", name);
53517      composeMedicinalProductInteractionInner(element);
53518    }
53519  }
53520
53521  protected void composeMedicinalProductInteractionInner(MedicinalProductInteraction element) throws IOException {
53522    composeDomainResourceElements(element);
53523    if (element.hasSubject()) {
53524      openArray("subject");
53525      for (Reference e : element.getSubject())
53526        composeReference(null, e);
53527      closeArray();
53528    }
53529    ;
53530    if (element.hasDescriptionElement()) {
53531      composeStringCore("description", element.getDescriptionElement(), false);
53532      composeStringExtras("description", element.getDescriptionElement(), false);
53533    }
53534    if (element.hasInteractant()) {
53535      openArray("interactant");
53536      for (MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent e : element.getInteractant())
53537        composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(null, e);
53538      closeArray();
53539    }
53540    ;
53541    if (element.hasType()) {
53542      composeCodeableConcept("type", element.getType());
53543    }
53544    if (element.hasEffect()) {
53545      composeCodeableConcept("effect", element.getEffect());
53546    }
53547    if (element.hasIncidence()) {
53548      composeCodeableConcept("incidence", element.getIncidence());
53549    }
53550    if (element.hasManagement()) {
53551      composeCodeableConcept("management", element.getManagement());
53552    }
53553  }
53554
53555  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(String name,
53556      MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
53557    if (element != null) {
53558      open(name);
53559      composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(element);
53560      close();
53561    }
53562  }
53563
53564  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(
53565      MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
53566    composeBackbone(element);
53567    if (element.hasItem()) {
53568      composeType("item", element.getItem());
53569    }
53570  }
53571
53572  protected void composeMedicinalProductManufactured(String name, MedicinalProductManufactured element)
53573      throws IOException {
53574    if (element != null) {
53575      prop("resourceType", name);
53576      composeMedicinalProductManufacturedInner(element);
53577    }
53578  }
53579
53580  protected void composeMedicinalProductManufacturedInner(MedicinalProductManufactured element) throws IOException {
53581    composeDomainResourceElements(element);
53582    if (element.hasManufacturedDoseForm()) {
53583      composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
53584    }
53585    if (element.hasUnitOfPresentation()) {
53586      composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
53587    }
53588    if (element.hasQuantity()) {
53589      composeQuantity("quantity", element.getQuantity());
53590    }
53591    if (element.hasManufacturer()) {
53592      openArray("manufacturer");
53593      for (Reference e : element.getManufacturer())
53594        composeReference(null, e);
53595      closeArray();
53596    }
53597    ;
53598    if (element.hasIngredient()) {
53599      openArray("ingredient");
53600      for (Reference e : element.getIngredient())
53601        composeReference(null, e);
53602      closeArray();
53603    }
53604    ;
53605    if (element.hasPhysicalCharacteristics()) {
53606      composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
53607    }
53608    if (element.hasOtherCharacteristics()) {
53609      openArray("otherCharacteristics");
53610      for (CodeableConcept e : element.getOtherCharacteristics())
53611        composeCodeableConcept(null, e);
53612      closeArray();
53613    }
53614    ;
53615  }
53616
53617  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
53618    if (element != null) {
53619      prop("resourceType", name);
53620      composeMedicinalProductPackagedInner(element);
53621    }
53622  }
53623
53624  protected void composeMedicinalProductPackagedInner(MedicinalProductPackaged element) throws IOException {
53625    composeDomainResourceElements(element);
53626    if (element.hasIdentifier()) {
53627      openArray("identifier");
53628      for (Identifier e : element.getIdentifier())
53629        composeIdentifier(null, e);
53630      closeArray();
53631    }
53632    ;
53633    if (element.hasSubject()) {
53634      openArray("subject");
53635      for (Reference e : element.getSubject())
53636        composeReference(null, e);
53637      closeArray();
53638    }
53639    ;
53640    if (element.hasDescriptionElement()) {
53641      composeStringCore("description", element.getDescriptionElement(), false);
53642      composeStringExtras("description", element.getDescriptionElement(), false);
53643    }
53644    if (element.hasLegalStatusOfSupply()) {
53645      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
53646    }
53647    if (element.hasMarketingStatus()) {
53648      openArray("marketingStatus");
53649      for (MarketingStatus e : element.getMarketingStatus())
53650        composeMarketingStatus(null, e);
53651      closeArray();
53652    }
53653    ;
53654    if (element.hasMarketingAuthorization()) {
53655      composeReference("marketingAuthorization", element.getMarketingAuthorization());
53656    }
53657    if (element.hasManufacturer()) {
53658      openArray("manufacturer");
53659      for (Reference e : element.getManufacturer())
53660        composeReference(null, e);
53661      closeArray();
53662    }
53663    ;
53664    if (element.hasBatchIdentifier()) {
53665      openArray("batchIdentifier");
53666      for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier())
53667        composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(null, e);
53668      closeArray();
53669    }
53670    ;
53671    if (element.hasPackageItem()) {
53672      openArray("packageItem");
53673      for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem())
53674        composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
53675      closeArray();
53676    }
53677    ;
53678  }
53679
53680  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name,
53681      MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
53682    if (element != null) {
53683      open(name);
53684      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(element);
53685      close();
53686    }
53687  }
53688
53689  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(
53690      MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
53691    composeBackbone(element);
53692    if (element.hasOuterPackaging()) {
53693      composeIdentifier("outerPackaging", element.getOuterPackaging());
53694    }
53695    if (element.hasImmediatePackaging()) {
53696      composeIdentifier("immediatePackaging", element.getImmediatePackaging());
53697    }
53698  }
53699
53700  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name,
53701      MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
53702    if (element != null) {
53703      open(name);
53704      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(element);
53705      close();
53706    }
53707  }
53708
53709  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(
53710      MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
53711    composeBackbone(element);
53712    if (element.hasIdentifier()) {
53713      openArray("identifier");
53714      for (Identifier e : element.getIdentifier())
53715        composeIdentifier(null, e);
53716      closeArray();
53717    }
53718    ;
53719    if (element.hasType()) {
53720      composeCodeableConcept("type", element.getType());
53721    }
53722    if (element.hasQuantity()) {
53723      composeQuantity("quantity", element.getQuantity());
53724    }
53725    if (element.hasMaterial()) {
53726      openArray("material");
53727      for (CodeableConcept e : element.getMaterial())
53728        composeCodeableConcept(null, e);
53729      closeArray();
53730    }
53731    ;
53732    if (element.hasAlternateMaterial()) {
53733      openArray("alternateMaterial");
53734      for (CodeableConcept e : element.getAlternateMaterial())
53735        composeCodeableConcept(null, e);
53736      closeArray();
53737    }
53738    ;
53739    if (element.hasDevice()) {
53740      openArray("device");
53741      for (Reference e : element.getDevice())
53742        composeReference(null, e);
53743      closeArray();
53744    }
53745    ;
53746    if (element.hasManufacturedItem()) {
53747      openArray("manufacturedItem");
53748      for (Reference e : element.getManufacturedItem())
53749        composeReference(null, e);
53750      closeArray();
53751    }
53752    ;
53753    if (element.hasPackageItem()) {
53754      openArray("packageItem");
53755      for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem())
53756        composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
53757      closeArray();
53758    }
53759    ;
53760    if (element.hasPhysicalCharacteristics()) {
53761      composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
53762    }
53763    if (element.hasOtherCharacteristics()) {
53764      openArray("otherCharacteristics");
53765      for (CodeableConcept e : element.getOtherCharacteristics())
53766        composeCodeableConcept(null, e);
53767      closeArray();
53768    }
53769    ;
53770    if (element.hasShelfLifeStorage()) {
53771      openArray("shelfLifeStorage");
53772      for (ProductShelfLife e : element.getShelfLifeStorage())
53773        composeProductShelfLife(null, e);
53774      closeArray();
53775    }
53776    ;
53777    if (element.hasManufacturer()) {
53778      openArray("manufacturer");
53779      for (Reference e : element.getManufacturer())
53780        composeReference(null, e);
53781      closeArray();
53782    }
53783    ;
53784  }
53785
53786  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element)
53787      throws IOException {
53788    if (element != null) {
53789      prop("resourceType", name);
53790      composeMedicinalProductPharmaceuticalInner(element);
53791    }
53792  }
53793
53794  protected void composeMedicinalProductPharmaceuticalInner(MedicinalProductPharmaceutical element) throws IOException {
53795    composeDomainResourceElements(element);
53796    if (element.hasIdentifier()) {
53797      openArray("identifier");
53798      for (Identifier e : element.getIdentifier())
53799        composeIdentifier(null, e);
53800      closeArray();
53801    }
53802    ;
53803    if (element.hasAdministrableDoseForm()) {
53804      composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
53805    }
53806    if (element.hasUnitOfPresentation()) {
53807      composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
53808    }
53809    if (element.hasIngredient()) {
53810      openArray("ingredient");
53811      for (Reference e : element.getIngredient())
53812        composeReference(null, e);
53813      closeArray();
53814    }
53815    ;
53816    if (element.hasDevice()) {
53817      openArray("device");
53818      for (Reference e : element.getDevice())
53819        composeReference(null, e);
53820      closeArray();
53821    }
53822    ;
53823    if (element.hasCharacteristics()) {
53824      openArray("characteristics");
53825      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element
53826          .getCharacteristics())
53827        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(null, e);
53828      closeArray();
53829    }
53830    ;
53831    if (element.hasRouteOfAdministration()) {
53832      openArray("routeOfAdministration");
53833      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent e : element
53834          .getRouteOfAdministration())
53835        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(null, e);
53836      closeArray();
53837    }
53838    ;
53839  }
53840
53841  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(
53842      String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element)
53843      throws IOException {
53844    if (element != null) {
53845      open(name);
53846      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(element);
53847      close();
53848    }
53849  }
53850
53851  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(
53852      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element)
53853      throws IOException {
53854    composeBackbone(element);
53855    if (element.hasCode()) {
53856      composeCodeableConcept("code", element.getCode());
53857    }
53858    if (element.hasStatus()) {
53859      composeCodeableConcept("status", element.getStatus());
53860    }
53861  }
53862
53863  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(
53864      String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element)
53865      throws IOException {
53866    if (element != null) {
53867      open(name);
53868      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(element);
53869      close();
53870    }
53871  }
53872
53873  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(
53874      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element)
53875      throws IOException {
53876    composeBackbone(element);
53877    if (element.hasCode()) {
53878      composeCodeableConcept("code", element.getCode());
53879    }
53880    if (element.hasFirstDose()) {
53881      composeQuantity("firstDose", element.getFirstDose());
53882    }
53883    if (element.hasMaxSingleDose()) {
53884      composeQuantity("maxSingleDose", element.getMaxSingleDose());
53885    }
53886    if (element.hasMaxDosePerDay()) {
53887      composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
53888    }
53889    if (element.hasMaxDosePerTreatmentPeriod()) {
53890      composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
53891    }
53892    if (element.hasMaxTreatmentPeriod()) {
53893      composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
53894    }
53895    if (element.hasTargetSpecies()) {
53896      openArray("targetSpecies");
53897      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent e : element
53898          .getTargetSpecies())
53899        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
53900            null, e);
53901      closeArray();
53902    }
53903    ;
53904  }
53905
53906  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(
53907      String name,
53908      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element)
53909      throws IOException {
53910    if (element != null) {
53911      open(name);
53912      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(
53913          element);
53914      close();
53915    }
53916  }
53917
53918  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(
53919      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element)
53920      throws IOException {
53921    composeBackbone(element);
53922    if (element.hasCode()) {
53923      composeCodeableConcept("code", element.getCode());
53924    }
53925    if (element.hasWithdrawalPeriod()) {
53926      openArray("withdrawalPeriod");
53927      for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element
53928          .getWithdrawalPeriod())
53929        composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
53930            null, e);
53931      closeArray();
53932    }
53933    ;
53934  }
53935
53936  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(
53937      String name,
53938      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element)
53939      throws IOException {
53940    if (element != null) {
53941      open(name);
53942      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(
53943          element);
53944      close();
53945    }
53946  }
53947
53948  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(
53949      MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element)
53950      throws IOException {
53951    composeBackbone(element);
53952    if (element.hasTissue()) {
53953      composeCodeableConcept("tissue", element.getTissue());
53954    }
53955    if (element.hasValue()) {
53956      composeQuantity("value", element.getValue());
53957    }
53958    if (element.hasSupportingInformationElement()) {
53959      composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
53960      composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
53961    }
53962  }
53963
53964  protected void composeMedicinalProductUndesirableEffect(String name, MedicinalProductUndesirableEffect element)
53965      throws IOException {
53966    if (element != null) {
53967      prop("resourceType", name);
53968      composeMedicinalProductUndesirableEffectInner(element);
53969    }
53970  }
53971
53972  protected void composeMedicinalProductUndesirableEffectInner(MedicinalProductUndesirableEffect element)
53973      throws IOException {
53974    composeDomainResourceElements(element);
53975    if (element.hasSubject()) {
53976      openArray("subject");
53977      for (Reference e : element.getSubject())
53978        composeReference(null, e);
53979      closeArray();
53980    }
53981    ;
53982    if (element.hasSymptomConditionEffect()) {
53983      composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
53984    }
53985    if (element.hasClassification()) {
53986      composeCodeableConcept("classification", element.getClassification());
53987    }
53988    if (element.hasFrequencyOfOccurrence()) {
53989      composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
53990    }
53991    if (element.hasPopulation()) {
53992      openArray("population");
53993      for (Population e : element.getPopulation())
53994        composePopulation(null, e);
53995      closeArray();
53996    }
53997    ;
53998  }
53999
54000  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
54001    if (element != null) {
54002      prop("resourceType", name);
54003      composeMessageDefinitionInner(element);
54004    }
54005  }
54006
54007  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
54008    composeDomainResourceElements(element);
54009    if (element.hasUrlElement()) {
54010      composeUriCore("url", element.getUrlElement(), false);
54011      composeUriExtras("url", element.getUrlElement(), false);
54012    }
54013    if (element.hasIdentifier()) {
54014      openArray("identifier");
54015      for (Identifier e : element.getIdentifier())
54016        composeIdentifier(null, e);
54017      closeArray();
54018    }
54019    ;
54020    if (element.hasVersionElement()) {
54021      composeStringCore("version", element.getVersionElement(), false);
54022      composeStringExtras("version", element.getVersionElement(), false);
54023    }
54024    if (element.hasNameElement()) {
54025      composeStringCore("name", element.getNameElement(), false);
54026      composeStringExtras("name", element.getNameElement(), false);
54027    }
54028    if (element.hasTitleElement()) {
54029      composeStringCore("title", element.getTitleElement(), false);
54030      composeStringExtras("title", element.getTitleElement(), false);
54031    }
54032    if (element.hasReplaces()) {
54033      openArray("replaces");
54034      for (CanonicalType e : element.getReplaces())
54035        composeCanonicalCore(null, e, true);
54036      closeArray();
54037      if (anyHasExtras(element.getReplaces())) {
54038        openArray("_replaces");
54039        for (CanonicalType e : element.getReplaces())
54040          composeCanonicalExtras(null, e, true);
54041        closeArray();
54042      }
54043    }
54044    ;
54045    if (element.hasStatusElement()) {
54046      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
54047          false);
54048      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
54049          false);
54050    }
54051    if (element.hasExperimentalElement()) {
54052      composeBooleanCore("experimental", element.getExperimentalElement(), false);
54053      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54054    }
54055    if (element.hasDateElement()) {
54056      composeDateTimeCore("date", element.getDateElement(), false);
54057      composeDateTimeExtras("date", element.getDateElement(), false);
54058    }
54059    if (element.hasPublisherElement()) {
54060      composeStringCore("publisher", element.getPublisherElement(), false);
54061      composeStringExtras("publisher", element.getPublisherElement(), false);
54062    }
54063    if (element.hasContact()) {
54064      openArray("contact");
54065      for (ContactDetail e : element.getContact())
54066        composeContactDetail(null, e);
54067      closeArray();
54068    }
54069    ;
54070    if (element.hasDescriptionElement()) {
54071      composeMarkdownCore("description", element.getDescriptionElement(), false);
54072      composeMarkdownExtras("description", element.getDescriptionElement(), false);
54073    }
54074    if (element.hasUseContext()) {
54075      openArray("useContext");
54076      for (UsageContext e : element.getUseContext())
54077        composeUsageContext(null, e);
54078      closeArray();
54079    }
54080    ;
54081    if (element.hasJurisdiction()) {
54082      openArray("jurisdiction");
54083      for (CodeableConcept e : element.getJurisdiction())
54084        composeCodeableConcept(null, e);
54085      closeArray();
54086    }
54087    ;
54088    if (element.hasPurposeElement()) {
54089      composeMarkdownCore("purpose", element.getPurposeElement(), false);
54090      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54091    }
54092    if (element.hasCopyrightElement()) {
54093      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54094      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54095    }
54096    if (element.hasBaseElement()) {
54097      composeCanonicalCore("base", element.getBaseElement(), false);
54098      composeCanonicalExtras("base", element.getBaseElement(), false);
54099    }
54100    if (element.hasParent()) {
54101      openArray("parent");
54102      for (CanonicalType e : element.getParent())
54103        composeCanonicalCore(null, e, true);
54104      closeArray();
54105      if (anyHasExtras(element.getParent())) {
54106        openArray("_parent");
54107        for (CanonicalType e : element.getParent())
54108          composeCanonicalExtras(null, e, true);
54109        closeArray();
54110      }
54111    }
54112    ;
54113    if (element.hasEvent()) {
54114      composeType("event", element.getEvent());
54115    }
54116    if (element.hasCategoryElement()) {
54117      composeEnumerationCore("category", element.getCategoryElement(),
54118          new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
54119      composeEnumerationExtras("category", element.getCategoryElement(),
54120          new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
54121    }
54122    if (element.hasFocus()) {
54123      openArray("focus");
54124      for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus())
54125        composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
54126      closeArray();
54127    }
54128    ;
54129    if (element.hasResponseRequiredElement()) {
54130      composeEnumerationCore("responseRequired", element.getResponseRequiredElement(),
54131          new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
54132      composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(),
54133          new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
54134    }
54135    if (element.hasAllowedResponse()) {
54136      openArray("allowedResponse");
54137      for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse())
54138        composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
54139      closeArray();
54140    }
54141    ;
54142    if (element.hasGraph()) {
54143      openArray("graph");
54144      for (CanonicalType e : element.getGraph())
54145        composeCanonicalCore(null, e, true);
54146      closeArray();
54147      if (anyHasExtras(element.getGraph())) {
54148        openArray("_graph");
54149        for (CanonicalType e : element.getGraph())
54150          composeCanonicalExtras(null, e, true);
54151        closeArray();
54152      }
54153    }
54154    ;
54155  }
54156
54157  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name,
54158      MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
54159    if (element != null) {
54160      open(name);
54161      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
54162      close();
54163    }
54164  }
54165
54166  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(
54167      MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
54168    composeBackbone(element);
54169    if (element.hasCodeElement()) {
54170      composeCodeCore("code", element.getCodeElement(), false);
54171      composeCodeExtras("code", element.getCodeElement(), false);
54172    }
54173    if (element.hasProfileElement()) {
54174      composeCanonicalCore("profile", element.getProfileElement(), false);
54175      composeCanonicalExtras("profile", element.getProfileElement(), false);
54176    }
54177    if (element.hasMinElement()) {
54178      composeUnsignedIntCore("min", element.getMinElement(), false);
54179      composeUnsignedIntExtras("min", element.getMinElement(), false);
54180    }
54181    if (element.hasMaxElement()) {
54182      composeStringCore("max", element.getMaxElement(), false);
54183      composeStringExtras("max", element.getMaxElement(), false);
54184    }
54185  }
54186
54187  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name,
54188      MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
54189    if (element != null) {
54190      open(name);
54191      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
54192      close();
54193    }
54194  }
54195
54196  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(
54197      MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
54198    composeBackbone(element);
54199    if (element.hasMessageElement()) {
54200      composeCanonicalCore("message", element.getMessageElement(), false);
54201      composeCanonicalExtras("message", element.getMessageElement(), false);
54202    }
54203    if (element.hasSituationElement()) {
54204      composeMarkdownCore("situation", element.getSituationElement(), false);
54205      composeMarkdownExtras("situation", element.getSituationElement(), false);
54206    }
54207  }
54208
54209  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
54210    if (element != null) {
54211      prop("resourceType", name);
54212      composeMessageHeaderInner(element);
54213    }
54214  }
54215
54216  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
54217    composeDomainResourceElements(element);
54218    if (element.hasEvent()) {
54219      composeType("event", element.getEvent());
54220    }
54221    if (element.hasDestination()) {
54222      openArray("destination");
54223      for (MessageHeader.MessageDestinationComponent e : element.getDestination())
54224        composeMessageHeaderMessageDestinationComponent(null, e);
54225      closeArray();
54226    }
54227    ;
54228    if (element.hasSender()) {
54229      composeReference("sender", element.getSender());
54230    }
54231    if (element.hasEnterer()) {
54232      composeReference("enterer", element.getEnterer());
54233    }
54234    if (element.hasAuthor()) {
54235      composeReference("author", element.getAuthor());
54236    }
54237    if (element.hasSource()) {
54238      composeMessageHeaderMessageSourceComponent("source", element.getSource());
54239    }
54240    if (element.hasResponsible()) {
54241      composeReference("responsible", element.getResponsible());
54242    }
54243    if (element.hasReason()) {
54244      composeCodeableConcept("reason", element.getReason());
54245    }
54246    if (element.hasResponse()) {
54247      composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
54248    }
54249    if (element.hasFocus()) {
54250      openArray("focus");
54251      for (Reference e : element.getFocus())
54252        composeReference(null, e);
54253      closeArray();
54254    }
54255    ;
54256    if (element.hasDefinitionElement()) {
54257      composeCanonicalCore("definition", element.getDefinitionElement(), false);
54258      composeCanonicalExtras("definition", element.getDefinitionElement(), false);
54259    }
54260  }
54261
54262  protected void composeMessageHeaderMessageDestinationComponent(String name,
54263      MessageHeader.MessageDestinationComponent element) throws IOException {
54264    if (element != null) {
54265      open(name);
54266      composeMessageHeaderMessageDestinationComponentInner(element);
54267      close();
54268    }
54269  }
54270
54271  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element)
54272      throws IOException {
54273    composeBackbone(element);
54274    if (element.hasNameElement()) {
54275      composeStringCore("name", element.getNameElement(), false);
54276      composeStringExtras("name", element.getNameElement(), false);
54277    }
54278    if (element.hasTarget()) {
54279      composeReference("target", element.getTarget());
54280    }
54281    if (element.hasEndpointElement()) {
54282      composeUrlCore("endpoint", element.getEndpointElement(), false);
54283      composeUrlExtras("endpoint", element.getEndpointElement(), false);
54284    }
54285    if (element.hasReceiver()) {
54286      composeReference("receiver", element.getReceiver());
54287    }
54288  }
54289
54290  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element)
54291      throws IOException {
54292    if (element != null) {
54293      open(name);
54294      composeMessageHeaderMessageSourceComponentInner(element);
54295      close();
54296    }
54297  }
54298
54299  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element)
54300      throws IOException {
54301    composeBackbone(element);
54302    if (element.hasNameElement()) {
54303      composeStringCore("name", element.getNameElement(), false);
54304      composeStringExtras("name", element.getNameElement(), false);
54305    }
54306    if (element.hasSoftwareElement()) {
54307      composeStringCore("software", element.getSoftwareElement(), false);
54308      composeStringExtras("software", element.getSoftwareElement(), false);
54309    }
54310    if (element.hasVersionElement()) {
54311      composeStringCore("version", element.getVersionElement(), false);
54312      composeStringExtras("version", element.getVersionElement(), false);
54313    }
54314    if (element.hasContact()) {
54315      composeContactPoint("contact", element.getContact());
54316    }
54317    if (element.hasEndpointElement()) {
54318      composeUrlCore("endpoint", element.getEndpointElement(), false);
54319      composeUrlExtras("endpoint", element.getEndpointElement(), false);
54320    }
54321  }
54322
54323  protected void composeMessageHeaderMessageHeaderResponseComponent(String name,
54324      MessageHeader.MessageHeaderResponseComponent element) throws IOException {
54325    if (element != null) {
54326      open(name);
54327      composeMessageHeaderMessageHeaderResponseComponentInner(element);
54328      close();
54329    }
54330  }
54331
54332  protected void composeMessageHeaderMessageHeaderResponseComponentInner(
54333      MessageHeader.MessageHeaderResponseComponent element) throws IOException {
54334    composeBackbone(element);
54335    if (element.hasIdentifierElement()) {
54336      composeIdCore("identifier", element.getIdentifierElement(), false);
54337      composeIdExtras("identifier", element.getIdentifierElement(), false);
54338    }
54339    if (element.hasCodeElement()) {
54340      composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
54341      composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
54342    }
54343    if (element.hasDetails()) {
54344      composeReference("details", element.getDetails());
54345    }
54346  }
54347
54348  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
54349    if (element != null) {
54350      prop("resourceType", name);
54351      composeMolecularSequenceInner(element);
54352    }
54353  }
54354
54355  protected void composeMolecularSequenceInner(MolecularSequence element) throws IOException {
54356    composeDomainResourceElements(element);
54357    if (element.hasIdentifier()) {
54358      openArray("identifier");
54359      for (Identifier e : element.getIdentifier())
54360        composeIdentifier(null, e);
54361      closeArray();
54362    }
54363    ;
54364    if (element.hasTypeElement()) {
54365      composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
54366      composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(),
54367          false);
54368    }
54369    if (element.hasCoordinateSystemElement()) {
54370      composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
54371      composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
54372    }
54373    if (element.hasPatient()) {
54374      composeReference("patient", element.getPatient());
54375    }
54376    if (element.hasSpecimen()) {
54377      composeReference("specimen", element.getSpecimen());
54378    }
54379    if (element.hasDevice()) {
54380      composeReference("device", element.getDevice());
54381    }
54382    if (element.hasPerformer()) {
54383      composeReference("performer", element.getPerformer());
54384    }
54385    if (element.hasQuantity()) {
54386      composeQuantity("quantity", element.getQuantity());
54387    }
54388    if (element.hasReferenceSeq()) {
54389      composeMolecularSequenceMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
54390    }
54391    if (element.hasVariant()) {
54392      openArray("variant");
54393      for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant())
54394        composeMolecularSequenceMolecularSequenceVariantComponent(null, e);
54395      closeArray();
54396    }
54397    ;
54398    if (element.hasObservedSeqElement()) {
54399      composeStringCore("observedSeq", element.getObservedSeqElement(), false);
54400      composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
54401    }
54402    if (element.hasQuality()) {
54403      openArray("quality");
54404      for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality())
54405        composeMolecularSequenceMolecularSequenceQualityComponent(null, e);
54406      closeArray();
54407    }
54408    ;
54409    if (element.hasReadCoverageElement()) {
54410      composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
54411      composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
54412    }
54413    if (element.hasRepository()) {
54414      openArray("repository");
54415      for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository())
54416        composeMolecularSequenceMolecularSequenceRepositoryComponent(null, e);
54417      closeArray();
54418    }
54419    ;
54420    if (element.hasPointer()) {
54421      openArray("pointer");
54422      for (Reference e : element.getPointer())
54423        composeReference(null, e);
54424      closeArray();
54425    }
54426    ;
54427    if (element.hasStructureVariant()) {
54428      openArray("structureVariant");
54429      for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant())
54430        composeMolecularSequenceMolecularSequenceStructureVariantComponent(null, e);
54431      closeArray();
54432    }
54433    ;
54434  }
54435
54436  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponent(String name,
54437      MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
54438    if (element != null) {
54439      open(name);
54440      composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(element);
54441      close();
54442    }
54443  }
54444
54445  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(
54446      MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
54447    composeBackbone(element);
54448    if (element.hasChromosome()) {
54449      composeCodeableConcept("chromosome", element.getChromosome());
54450    }
54451    if (element.hasGenomeBuildElement()) {
54452      composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
54453      composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
54454    }
54455    if (element.hasOrientationElement()) {
54456      composeEnumerationCore("orientation", element.getOrientationElement(),
54457          new MolecularSequence.OrientationTypeEnumFactory(), false);
54458      composeEnumerationExtras("orientation", element.getOrientationElement(),
54459          new MolecularSequence.OrientationTypeEnumFactory(), false);
54460    }
54461    if (element.hasReferenceSeqId()) {
54462      composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
54463    }
54464    if (element.hasReferenceSeqPointer()) {
54465      composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
54466    }
54467    if (element.hasReferenceSeqStringElement()) {
54468      composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
54469      composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
54470    }
54471    if (element.hasStrandElement()) {
54472      composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(),
54473          false);
54474      composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(),
54475          false);
54476    }
54477    if (element.hasWindowStartElement()) {
54478      composeIntegerCore("windowStart", element.getWindowStartElement(), false);
54479      composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
54480    }
54481    if (element.hasWindowEndElement()) {
54482      composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
54483      composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
54484    }
54485  }
54486
54487  protected void composeMolecularSequenceMolecularSequenceVariantComponent(String name,
54488      MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
54489    if (element != null) {
54490      open(name);
54491      composeMolecularSequenceMolecularSequenceVariantComponentInner(element);
54492      close();
54493    }
54494  }
54495
54496  protected void composeMolecularSequenceMolecularSequenceVariantComponentInner(
54497      MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
54498    composeBackbone(element);
54499    if (element.hasStartElement()) {
54500      composeIntegerCore("start", element.getStartElement(), false);
54501      composeIntegerExtras("start", element.getStartElement(), false);
54502    }
54503    if (element.hasEndElement()) {
54504      composeIntegerCore("end", element.getEndElement(), false);
54505      composeIntegerExtras("end", element.getEndElement(), false);
54506    }
54507    if (element.hasObservedAlleleElement()) {
54508      composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
54509      composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
54510    }
54511    if (element.hasReferenceAlleleElement()) {
54512      composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
54513      composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
54514    }
54515    if (element.hasCigarElement()) {
54516      composeStringCore("cigar", element.getCigarElement(), false);
54517      composeStringExtras("cigar", element.getCigarElement(), false);
54518    }
54519    if (element.hasVariantPointer()) {
54520      composeReference("variantPointer", element.getVariantPointer());
54521    }
54522  }
54523
54524  protected void composeMolecularSequenceMolecularSequenceQualityComponent(String name,
54525      MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
54526    if (element != null) {
54527      open(name);
54528      composeMolecularSequenceMolecularSequenceQualityComponentInner(element);
54529      close();
54530    }
54531  }
54532
54533  protected void composeMolecularSequenceMolecularSequenceQualityComponentInner(
54534      MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
54535    composeBackbone(element);
54536    if (element.hasTypeElement()) {
54537      composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
54538      composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
54539    }
54540    if (element.hasStandardSequence()) {
54541      composeCodeableConcept("standardSequence", element.getStandardSequence());
54542    }
54543    if (element.hasStartElement()) {
54544      composeIntegerCore("start", element.getStartElement(), false);
54545      composeIntegerExtras("start", element.getStartElement(), false);
54546    }
54547    if (element.hasEndElement()) {
54548      composeIntegerCore("end", element.getEndElement(), false);
54549      composeIntegerExtras("end", element.getEndElement(), false);
54550    }
54551    if (element.hasScore()) {
54552      composeQuantity("score", element.getScore());
54553    }
54554    if (element.hasMethod()) {
54555      composeCodeableConcept("method", element.getMethod());
54556    }
54557    if (element.hasTruthTPElement()) {
54558      composeDecimalCore("truthTP", element.getTruthTPElement(), false);
54559      composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
54560    }
54561    if (element.hasQueryTPElement()) {
54562      composeDecimalCore("queryTP", element.getQueryTPElement(), false);
54563      composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
54564    }
54565    if (element.hasTruthFNElement()) {
54566      composeDecimalCore("truthFN", element.getTruthFNElement(), false);
54567      composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
54568    }
54569    if (element.hasQueryFPElement()) {
54570      composeDecimalCore("queryFP", element.getQueryFPElement(), false);
54571      composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
54572    }
54573    if (element.hasGtFPElement()) {
54574      composeDecimalCore("gtFP", element.getGtFPElement(), false);
54575      composeDecimalExtras("gtFP", element.getGtFPElement(), false);
54576    }
54577    if (element.hasPrecisionElement()) {
54578      composeDecimalCore("precision", element.getPrecisionElement(), false);
54579      composeDecimalExtras("precision", element.getPrecisionElement(), false);
54580    }
54581    if (element.hasRecallElement()) {
54582      composeDecimalCore("recall", element.getRecallElement(), false);
54583      composeDecimalExtras("recall", element.getRecallElement(), false);
54584    }
54585    if (element.hasFScoreElement()) {
54586      composeDecimalCore("fScore", element.getFScoreElement(), false);
54587      composeDecimalExtras("fScore", element.getFScoreElement(), false);
54588    }
54589    if (element.hasRoc()) {
54590      composeMolecularSequenceMolecularSequenceQualityRocComponent("roc", element.getRoc());
54591    }
54592  }
54593
54594  protected void composeMolecularSequenceMolecularSequenceQualityRocComponent(String name,
54595      MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
54596    if (element != null) {
54597      open(name);
54598      composeMolecularSequenceMolecularSequenceQualityRocComponentInner(element);
54599      close();
54600    }
54601  }
54602
54603  protected void composeMolecularSequenceMolecularSequenceQualityRocComponentInner(
54604      MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
54605    composeBackbone(element);
54606    if (element.hasScore()) {
54607      openArray("score");
54608      for (IntegerType e : element.getScore())
54609        composeIntegerCore(null, e, true);
54610      closeArray();
54611      if (anyHasExtras(element.getScore())) {
54612        openArray("_score");
54613        for (IntegerType e : element.getScore())
54614          composeIntegerExtras(null, e, true);
54615        closeArray();
54616      }
54617    }
54618    ;
54619    if (element.hasNumTP()) {
54620      openArray("numTP");
54621      for (IntegerType e : element.getNumTP())
54622        composeIntegerCore(null, e, true);
54623      closeArray();
54624      if (anyHasExtras(element.getNumTP())) {
54625        openArray("_numTP");
54626        for (IntegerType e : element.getNumTP())
54627          composeIntegerExtras(null, e, true);
54628        closeArray();
54629      }
54630    }
54631    ;
54632    if (element.hasNumFP()) {
54633      openArray("numFP");
54634      for (IntegerType e : element.getNumFP())
54635        composeIntegerCore(null, e, true);
54636      closeArray();
54637      if (anyHasExtras(element.getNumFP())) {
54638        openArray("_numFP");
54639        for (IntegerType e : element.getNumFP())
54640          composeIntegerExtras(null, e, true);
54641        closeArray();
54642      }
54643    }
54644    ;
54645    if (element.hasNumFN()) {
54646      openArray("numFN");
54647      for (IntegerType e : element.getNumFN())
54648        composeIntegerCore(null, e, true);
54649      closeArray();
54650      if (anyHasExtras(element.getNumFN())) {
54651        openArray("_numFN");
54652        for (IntegerType e : element.getNumFN())
54653          composeIntegerExtras(null, e, true);
54654        closeArray();
54655      }
54656    }
54657    ;
54658    if (element.hasPrecision()) {
54659      openArray("precision");
54660      for (DecimalType e : element.getPrecision())
54661        composeDecimalCore(null, e, true);
54662      closeArray();
54663      if (anyHasExtras(element.getPrecision())) {
54664        openArray("_precision");
54665        for (DecimalType e : element.getPrecision())
54666          composeDecimalExtras(null, e, true);
54667        closeArray();
54668      }
54669    }
54670    ;
54671    if (element.hasSensitivity()) {
54672      openArray("sensitivity");
54673      for (DecimalType e : element.getSensitivity())
54674        composeDecimalCore(null, e, true);
54675      closeArray();
54676      if (anyHasExtras(element.getSensitivity())) {
54677        openArray("_sensitivity");
54678        for (DecimalType e : element.getSensitivity())
54679          composeDecimalExtras(null, e, true);
54680        closeArray();
54681      }
54682    }
54683    ;
54684    if (element.hasFMeasure()) {
54685      openArray("fMeasure");
54686      for (DecimalType e : element.getFMeasure())
54687        composeDecimalCore(null, e, true);
54688      closeArray();
54689      if (anyHasExtras(element.getFMeasure())) {
54690        openArray("_fMeasure");
54691        for (DecimalType e : element.getFMeasure())
54692          composeDecimalExtras(null, e, true);
54693        closeArray();
54694      }
54695    }
54696    ;
54697  }
54698
54699  protected void composeMolecularSequenceMolecularSequenceRepositoryComponent(String name,
54700      MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
54701    if (element != null) {
54702      open(name);
54703      composeMolecularSequenceMolecularSequenceRepositoryComponentInner(element);
54704      close();
54705    }
54706  }
54707
54708  protected void composeMolecularSequenceMolecularSequenceRepositoryComponentInner(
54709      MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
54710    composeBackbone(element);
54711    if (element.hasTypeElement()) {
54712      composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(),
54713          false);
54714      composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(),
54715          false);
54716    }
54717    if (element.hasUrlElement()) {
54718      composeUriCore("url", element.getUrlElement(), false);
54719      composeUriExtras("url", element.getUrlElement(), false);
54720    }
54721    if (element.hasNameElement()) {
54722      composeStringCore("name", element.getNameElement(), false);
54723      composeStringExtras("name", element.getNameElement(), false);
54724    }
54725    if (element.hasDatasetIdElement()) {
54726      composeStringCore("datasetId", element.getDatasetIdElement(), false);
54727      composeStringExtras("datasetId", element.getDatasetIdElement(), false);
54728    }
54729    if (element.hasVariantsetIdElement()) {
54730      composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
54731      composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
54732    }
54733    if (element.hasReadsetIdElement()) {
54734      composeStringCore("readsetId", element.getReadsetIdElement(), false);
54735      composeStringExtras("readsetId", element.getReadsetIdElement(), false);
54736    }
54737  }
54738
54739  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponent(String name,
54740      MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
54741    if (element != null) {
54742      open(name);
54743      composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(element);
54744      close();
54745    }
54746  }
54747
54748  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(
54749      MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
54750    composeBackbone(element);
54751    if (element.hasVariantType()) {
54752      composeCodeableConcept("variantType", element.getVariantType());
54753    }
54754    if (element.hasExactElement()) {
54755      composeBooleanCore("exact", element.getExactElement(), false);
54756      composeBooleanExtras("exact", element.getExactElement(), false);
54757    }
54758    if (element.hasLengthElement()) {
54759      composeIntegerCore("length", element.getLengthElement(), false);
54760      composeIntegerExtras("length", element.getLengthElement(), false);
54761    }
54762    if (element.hasOuter()) {
54763      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
54764    }
54765    if (element.hasInner()) {
54766      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
54767    }
54768  }
54769
54770  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent(String name,
54771      MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
54772    if (element != null) {
54773      open(name);
54774      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(element);
54775      close();
54776    }
54777  }
54778
54779  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(
54780      MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
54781    composeBackbone(element);
54782    if (element.hasStartElement()) {
54783      composeIntegerCore("start", element.getStartElement(), false);
54784      composeIntegerExtras("start", element.getStartElement(), false);
54785    }
54786    if (element.hasEndElement()) {
54787      composeIntegerCore("end", element.getEndElement(), false);
54788      composeIntegerExtras("end", element.getEndElement(), false);
54789    }
54790  }
54791
54792  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent(String name,
54793      MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
54794    if (element != null) {
54795      open(name);
54796      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(element);
54797      close();
54798    }
54799  }
54800
54801  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(
54802      MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
54803    composeBackbone(element);
54804    if (element.hasStartElement()) {
54805      composeIntegerCore("start", element.getStartElement(), false);
54806      composeIntegerExtras("start", element.getStartElement(), false);
54807    }
54808    if (element.hasEndElement()) {
54809      composeIntegerCore("end", element.getEndElement(), false);
54810      composeIntegerExtras("end", element.getEndElement(), false);
54811    }
54812  }
54813
54814  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
54815    if (element != null) {
54816      prop("resourceType", name);
54817      composeNamingSystemInner(element);
54818    }
54819  }
54820
54821  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
54822    composeDomainResourceElements(element);
54823    if (element.hasNameElement()) {
54824      composeStringCore("name", element.getNameElement(), false);
54825      composeStringExtras("name", element.getNameElement(), false);
54826    }
54827    if (element.hasStatusElement()) {
54828      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
54829          false);
54830      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
54831          false);
54832    }
54833    if (element.hasKindElement()) {
54834      composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
54835      composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
54836    }
54837    if (element.hasDateElement()) {
54838      composeDateTimeCore("date", element.getDateElement(), false);
54839      composeDateTimeExtras("date", element.getDateElement(), false);
54840    }
54841    if (element.hasPublisherElement()) {
54842      composeStringCore("publisher", element.getPublisherElement(), false);
54843      composeStringExtras("publisher", element.getPublisherElement(), false);
54844    }
54845    if (element.hasContact()) {
54846      openArray("contact");
54847      for (ContactDetail e : element.getContact())
54848        composeContactDetail(null, e);
54849      closeArray();
54850    }
54851    ;
54852    if (element.hasResponsibleElement()) {
54853      composeStringCore("responsible", element.getResponsibleElement(), false);
54854      composeStringExtras("responsible", element.getResponsibleElement(), false);
54855    }
54856    if (element.hasType()) {
54857      composeCodeableConcept("type", element.getType());
54858    }
54859    if (element.hasDescriptionElement()) {
54860      composeMarkdownCore("description", element.getDescriptionElement(), false);
54861      composeMarkdownExtras("description", element.getDescriptionElement(), false);
54862    }
54863    if (element.hasUseContext()) {
54864      openArray("useContext");
54865      for (UsageContext e : element.getUseContext())
54866        composeUsageContext(null, e);
54867      closeArray();
54868    }
54869    ;
54870    if (element.hasJurisdiction()) {
54871      openArray("jurisdiction");
54872      for (CodeableConcept e : element.getJurisdiction())
54873        composeCodeableConcept(null, e);
54874      closeArray();
54875    }
54876    ;
54877    if (element.hasUsageElement()) {
54878      composeStringCore("usage", element.getUsageElement(), false);
54879      composeStringExtras("usage", element.getUsageElement(), false);
54880    }
54881    if (element.hasUniqueId()) {
54882      openArray("uniqueId");
54883      for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId())
54884        composeNamingSystemNamingSystemUniqueIdComponent(null, e);
54885      closeArray();
54886    }
54887    ;
54888  }
54889
54890  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name,
54891      NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
54892    if (element != null) {
54893      open(name);
54894      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
54895      close();
54896    }
54897  }
54898
54899  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(
54900      NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
54901    composeBackbone(element);
54902    if (element.hasTypeElement()) {
54903      composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(),
54904          false);
54905      composeEnumerationExtras("type", element.getTypeElement(),
54906          new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
54907    }
54908    if (element.hasValueElement()) {
54909      composeStringCore("value", element.getValueElement(), false);
54910      composeStringExtras("value", element.getValueElement(), false);
54911    }
54912    if (element.hasPreferredElement()) {
54913      composeBooleanCore("preferred", element.getPreferredElement(), false);
54914      composeBooleanExtras("preferred", element.getPreferredElement(), false);
54915    }
54916    if (element.hasCommentElement()) {
54917      composeStringCore("comment", element.getCommentElement(), false);
54918      composeStringExtras("comment", element.getCommentElement(), false);
54919    }
54920    if (element.hasPeriod()) {
54921      composePeriod("period", element.getPeriod());
54922    }
54923  }
54924
54925  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
54926    if (element != null) {
54927      prop("resourceType", name);
54928      composeNutritionOrderInner(element);
54929    }
54930  }
54931
54932  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
54933    composeDomainResourceElements(element);
54934    if (element.hasIdentifier()) {
54935      openArray("identifier");
54936      for (Identifier e : element.getIdentifier())
54937        composeIdentifier(null, e);
54938      closeArray();
54939    }
54940    ;
54941    if (element.hasInstantiatesCanonical()) {
54942      openArray("instantiatesCanonical");
54943      for (CanonicalType e : element.getInstantiatesCanonical())
54944        composeCanonicalCore(null, e, true);
54945      closeArray();
54946      if (anyHasExtras(element.getInstantiatesCanonical())) {
54947        openArray("_instantiatesCanonical");
54948        for (CanonicalType e : element.getInstantiatesCanonical())
54949          composeCanonicalExtras(null, e, true);
54950        closeArray();
54951      }
54952    }
54953    ;
54954    if (element.hasInstantiatesUri()) {
54955      openArray("instantiatesUri");
54956      for (UriType e : element.getInstantiatesUri())
54957        composeUriCore(null, e, true);
54958      closeArray();
54959      if (anyHasExtras(element.getInstantiatesUri())) {
54960        openArray("_instantiatesUri");
54961        for (UriType e : element.getInstantiatesUri())
54962          composeUriExtras(null, e, true);
54963        closeArray();
54964      }
54965    }
54966    ;
54967    if (element.hasInstantiates()) {
54968      openArray("instantiates");
54969      for (UriType e : element.getInstantiates())
54970        composeUriCore(null, e, true);
54971      closeArray();
54972      if (anyHasExtras(element.getInstantiates())) {
54973        openArray("_instantiates");
54974        for (UriType e : element.getInstantiates())
54975          composeUriExtras(null, e, true);
54976        closeArray();
54977      }
54978    }
54979    ;
54980    if (element.hasStatusElement()) {
54981      composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(),
54982          false);
54983      composeEnumerationExtras("status", element.getStatusElement(),
54984          new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
54985    }
54986    if (element.hasIntentElement()) {
54987      composeEnumerationCore("intent", element.getIntentElement(),
54988          new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
54989      composeEnumerationExtras("intent", element.getIntentElement(),
54990          new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
54991    }
54992    if (element.hasPatient()) {
54993      composeReference("patient", element.getPatient());
54994    }
54995    if (element.hasEncounter()) {
54996      composeReference("encounter", element.getEncounter());
54997    }
54998    if (element.hasDateTimeElement()) {
54999      composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
55000      composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
55001    }
55002    if (element.hasOrderer()) {
55003      composeReference("orderer", element.getOrderer());
55004    }
55005    if (element.hasAllergyIntolerance()) {
55006      openArray("allergyIntolerance");
55007      for (Reference e : element.getAllergyIntolerance())
55008        composeReference(null, e);
55009      closeArray();
55010    }
55011    ;
55012    if (element.hasFoodPreferenceModifier()) {
55013      openArray("foodPreferenceModifier");
55014      for (CodeableConcept e : element.getFoodPreferenceModifier())
55015        composeCodeableConcept(null, e);
55016      closeArray();
55017    }
55018    ;
55019    if (element.hasExcludeFoodModifier()) {
55020      openArray("excludeFoodModifier");
55021      for (CodeableConcept e : element.getExcludeFoodModifier())
55022        composeCodeableConcept(null, e);
55023      closeArray();
55024    }
55025    ;
55026    if (element.hasOralDiet()) {
55027      composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
55028    }
55029    if (element.hasSupplement()) {
55030      openArray("supplement");
55031      for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement())
55032        composeNutritionOrderNutritionOrderSupplementComponent(null, e);
55033      closeArray();
55034    }
55035    ;
55036    if (element.hasEnteralFormula()) {
55037      composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
55038    }
55039    if (element.hasNote()) {
55040      openArray("note");
55041      for (Annotation e : element.getNote())
55042        composeAnnotation(null, e);
55043      closeArray();
55044    }
55045    ;
55046  }
55047
55048  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name,
55049      NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
55050    if (element != null) {
55051      open(name);
55052      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
55053      close();
55054    }
55055  }
55056
55057  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(
55058      NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
55059    composeBackbone(element);
55060    if (element.hasType()) {
55061      openArray("type");
55062      for (CodeableConcept e : element.getType())
55063        composeCodeableConcept(null, e);
55064      closeArray();
55065    }
55066    ;
55067    if (element.hasSchedule()) {
55068      openArray("schedule");
55069      for (Timing e : element.getSchedule())
55070        composeTiming(null, e);
55071      closeArray();
55072    }
55073    ;
55074    if (element.hasNutrient()) {
55075      openArray("nutrient");
55076      for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient())
55077        composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
55078      closeArray();
55079    }
55080    ;
55081    if (element.hasTexture()) {
55082      openArray("texture");
55083      for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture())
55084        composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
55085      closeArray();
55086    }
55087    ;
55088    if (element.hasFluidConsistencyType()) {
55089      openArray("fluidConsistencyType");
55090      for (CodeableConcept e : element.getFluidConsistencyType())
55091        composeCodeableConcept(null, e);
55092      closeArray();
55093    }
55094    ;
55095    if (element.hasInstructionElement()) {
55096      composeStringCore("instruction", element.getInstructionElement(), false);
55097      composeStringExtras("instruction", element.getInstructionElement(), false);
55098    }
55099  }
55100
55101  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name,
55102      NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
55103    if (element != null) {
55104      open(name);
55105      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
55106      close();
55107    }
55108  }
55109
55110  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(
55111      NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
55112    composeBackbone(element);
55113    if (element.hasModifier()) {
55114      composeCodeableConcept("modifier", element.getModifier());
55115    }
55116    if (element.hasAmount()) {
55117      composeQuantity("amount", element.getAmount());
55118    }
55119  }
55120
55121  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name,
55122      NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
55123    if (element != null) {
55124      open(name);
55125      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
55126      close();
55127    }
55128  }
55129
55130  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(
55131      NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
55132    composeBackbone(element);
55133    if (element.hasModifier()) {
55134      composeCodeableConcept("modifier", element.getModifier());
55135    }
55136    if (element.hasFoodType()) {
55137      composeCodeableConcept("foodType", element.getFoodType());
55138    }
55139  }
55140
55141  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name,
55142      NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
55143    if (element != null) {
55144      open(name);
55145      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
55146      close();
55147    }
55148  }
55149
55150  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(
55151      NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
55152    composeBackbone(element);
55153    if (element.hasType()) {
55154      composeCodeableConcept("type", element.getType());
55155    }
55156    if (element.hasProductNameElement()) {
55157      composeStringCore("productName", element.getProductNameElement(), false);
55158      composeStringExtras("productName", element.getProductNameElement(), false);
55159    }
55160    if (element.hasSchedule()) {
55161      openArray("schedule");
55162      for (Timing e : element.getSchedule())
55163        composeTiming(null, e);
55164      closeArray();
55165    }
55166    ;
55167    if (element.hasQuantity()) {
55168      composeQuantity("quantity", element.getQuantity());
55169    }
55170    if (element.hasInstructionElement()) {
55171      composeStringCore("instruction", element.getInstructionElement(), false);
55172      composeStringExtras("instruction", element.getInstructionElement(), false);
55173    }
55174  }
55175
55176  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name,
55177      NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
55178    if (element != null) {
55179      open(name);
55180      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
55181      close();
55182    }
55183  }
55184
55185  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(
55186      NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
55187    composeBackbone(element);
55188    if (element.hasBaseFormulaType()) {
55189      composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
55190    }
55191    if (element.hasBaseFormulaProductNameElement()) {
55192      composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
55193      composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
55194    }
55195    if (element.hasAdditiveType()) {
55196      composeCodeableConcept("additiveType", element.getAdditiveType());
55197    }
55198    if (element.hasAdditiveProductNameElement()) {
55199      composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
55200      composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
55201    }
55202    if (element.hasCaloricDensity()) {
55203      composeQuantity("caloricDensity", element.getCaloricDensity());
55204    }
55205    if (element.hasRouteofAdministration()) {
55206      composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
55207    }
55208    if (element.hasAdministration()) {
55209      openArray("administration");
55210      for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration())
55211        composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
55212      closeArray();
55213    }
55214    ;
55215    if (element.hasMaxVolumeToDeliver()) {
55216      composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
55217    }
55218    if (element.hasAdministrationInstructionElement()) {
55219      composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
55220      composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
55221    }
55222  }
55223
55224  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name,
55225      NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
55226    if (element != null) {
55227      open(name);
55228      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
55229      close();
55230    }
55231  }
55232
55233  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(
55234      NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
55235    composeBackbone(element);
55236    if (element.hasSchedule()) {
55237      composeTiming("schedule", element.getSchedule());
55238    }
55239    if (element.hasQuantity()) {
55240      composeQuantity("quantity", element.getQuantity());
55241    }
55242    if (element.hasRate()) {
55243      composeType("rate", element.getRate());
55244    }
55245  }
55246
55247  protected void composeObservation(String name, Observation element) throws IOException {
55248    if (element != null) {
55249      prop("resourceType", name);
55250      composeObservationInner(element);
55251    }
55252  }
55253
55254  protected void composeObservationInner(Observation element) throws IOException {
55255    composeDomainResourceElements(element);
55256    if (element.hasIdentifier()) {
55257      openArray("identifier");
55258      for (Identifier e : element.getIdentifier())
55259        composeIdentifier(null, e);
55260      closeArray();
55261    }
55262    ;
55263    if (element.hasBasedOn()) {
55264      openArray("basedOn");
55265      for (Reference e : element.getBasedOn())
55266        composeReference(null, e);
55267      closeArray();
55268    }
55269    ;
55270    if (element.hasPartOf()) {
55271      openArray("partOf");
55272      for (Reference e : element.getPartOf())
55273        composeReference(null, e);
55274      closeArray();
55275    }
55276    ;
55277    if (element.hasStatusElement()) {
55278      composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(),
55279          false);
55280      composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(),
55281          false);
55282    }
55283    if (element.hasCategory()) {
55284      openArray("category");
55285      for (CodeableConcept e : element.getCategory())
55286        composeCodeableConcept(null, e);
55287      closeArray();
55288    }
55289    ;
55290    if (element.hasCode()) {
55291      composeCodeableConcept("code", element.getCode());
55292    }
55293    if (element.hasSubject()) {
55294      composeReference("subject", element.getSubject());
55295    }
55296    if (element.hasFocus()) {
55297      openArray("focus");
55298      for (Reference e : element.getFocus())
55299        composeReference(null, e);
55300      closeArray();
55301    }
55302    ;
55303    if (element.hasEncounter()) {
55304      composeReference("encounter", element.getEncounter());
55305    }
55306    if (element.hasEffective()) {
55307      composeType("effective", element.getEffective());
55308    }
55309    if (element.hasIssuedElement()) {
55310      composeInstantCore("issued", element.getIssuedElement(), false);
55311      composeInstantExtras("issued", element.getIssuedElement(), false);
55312    }
55313    if (element.hasPerformer()) {
55314      openArray("performer");
55315      for (Reference e : element.getPerformer())
55316        composeReference(null, e);
55317      closeArray();
55318    }
55319    ;
55320    if (element.hasValue()) {
55321      composeType("value", element.getValue());
55322    }
55323    if (element.hasDataAbsentReason()) {
55324      composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
55325    }
55326    if (element.hasInterpretation()) {
55327      openArray("interpretation");
55328      for (CodeableConcept e : element.getInterpretation())
55329        composeCodeableConcept(null, e);
55330      closeArray();
55331    }
55332    ;
55333    if (element.hasNote()) {
55334      openArray("note");
55335      for (Annotation e : element.getNote())
55336        composeAnnotation(null, e);
55337      closeArray();
55338    }
55339    ;
55340    if (element.hasBodySite()) {
55341      composeCodeableConcept("bodySite", element.getBodySite());
55342    }
55343    if (element.hasMethod()) {
55344      composeCodeableConcept("method", element.getMethod());
55345    }
55346    if (element.hasSpecimen()) {
55347      composeReference("specimen", element.getSpecimen());
55348    }
55349    if (element.hasDevice()) {
55350      composeReference("device", element.getDevice());
55351    }
55352    if (element.hasReferenceRange()) {
55353      openArray("referenceRange");
55354      for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange())
55355        composeObservationObservationReferenceRangeComponent(null, e);
55356      closeArray();
55357    }
55358    ;
55359    if (element.hasHasMember()) {
55360      openArray("hasMember");
55361      for (Reference e : element.getHasMember())
55362        composeReference(null, e);
55363      closeArray();
55364    }
55365    ;
55366    if (element.hasDerivedFrom()) {
55367      openArray("derivedFrom");
55368      for (Reference e : element.getDerivedFrom())
55369        composeReference(null, e);
55370      closeArray();
55371    }
55372    ;
55373    if (element.hasComponent()) {
55374      openArray("component");
55375      for (Observation.ObservationComponentComponent e : element.getComponent())
55376        composeObservationObservationComponentComponent(null, e);
55377      closeArray();
55378    }
55379    ;
55380  }
55381
55382  protected void composeObservationObservationReferenceRangeComponent(String name,
55383      Observation.ObservationReferenceRangeComponent element) throws IOException {
55384    if (element != null) {
55385      open(name);
55386      composeObservationObservationReferenceRangeComponentInner(element);
55387      close();
55388    }
55389  }
55390
55391  protected void composeObservationObservationReferenceRangeComponentInner(
55392      Observation.ObservationReferenceRangeComponent element) throws IOException {
55393    composeBackbone(element);
55394    if (element.hasLow()) {
55395      composeQuantity("low", element.getLow());
55396    }
55397    if (element.hasHigh()) {
55398      composeQuantity("high", element.getHigh());
55399    }
55400    if (element.hasType()) {
55401      composeCodeableConcept("type", element.getType());
55402    }
55403    if (element.hasAppliesTo()) {
55404      openArray("appliesTo");
55405      for (CodeableConcept e : element.getAppliesTo())
55406        composeCodeableConcept(null, e);
55407      closeArray();
55408    }
55409    ;
55410    if (element.hasAge()) {
55411      composeRange("age", element.getAge());
55412    }
55413    if (element.hasTextElement()) {
55414      composeStringCore("text", element.getTextElement(), false);
55415      composeStringExtras("text", element.getTextElement(), false);
55416    }
55417  }
55418
55419  protected void composeObservationObservationComponentComponent(String name,
55420      Observation.ObservationComponentComponent element) throws IOException {
55421    if (element != null) {
55422      open(name);
55423      composeObservationObservationComponentComponentInner(element);
55424      close();
55425    }
55426  }
55427
55428  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element)
55429      throws IOException {
55430    composeBackbone(element);
55431    if (element.hasCode()) {
55432      composeCodeableConcept("code", element.getCode());
55433    }
55434    if (element.hasValue()) {
55435      composeType("value", element.getValue());
55436    }
55437    if (element.hasDataAbsentReason()) {
55438      composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
55439    }
55440    if (element.hasInterpretation()) {
55441      openArray("interpretation");
55442      for (CodeableConcept e : element.getInterpretation())
55443        composeCodeableConcept(null, e);
55444      closeArray();
55445    }
55446    ;
55447    if (element.hasReferenceRange()) {
55448      openArray("referenceRange");
55449      for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange())
55450        composeObservationObservationReferenceRangeComponent(null, e);
55451      closeArray();
55452    }
55453    ;
55454  }
55455
55456  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
55457    if (element != null) {
55458      prop("resourceType", name);
55459      composeObservationDefinitionInner(element);
55460    }
55461  }
55462
55463  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
55464    composeDomainResourceElements(element);
55465    if (element.hasCategory()) {
55466      openArray("category");
55467      for (CodeableConcept e : element.getCategory())
55468        composeCodeableConcept(null, e);
55469      closeArray();
55470    }
55471    ;
55472    if (element.hasCode()) {
55473      composeCodeableConcept("code", element.getCode());
55474    }
55475    if (element.hasIdentifier()) {
55476      openArray("identifier");
55477      for (Identifier e : element.getIdentifier())
55478        composeIdentifier(null, e);
55479      closeArray();
55480    }
55481    ;
55482    if (element.hasPermittedDataType()) {
55483      openArray("permittedDataType");
55484      for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType())
55485        composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
55486      closeArray();
55487      if (anyHasExtras(element.getPermittedDataType())) {
55488        openArray("_permittedDataType");
55489        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType())
55490          composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
55491        closeArray();
55492      }
55493    }
55494    ;
55495    if (element.hasMultipleResultsAllowedElement()) {
55496      composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
55497      composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
55498    }
55499    if (element.hasMethod()) {
55500      composeCodeableConcept("method", element.getMethod());
55501    }
55502    if (element.hasPreferredReportNameElement()) {
55503      composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
55504      composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
55505    }
55506    if (element.hasQuantitativeDetails()) {
55507      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails",
55508          element.getQuantitativeDetails());
55509    }
55510    if (element.hasQualifiedInterval()) {
55511      openArray("qualifiedInterval");
55512      for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval())
55513        composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
55514      closeArray();
55515    }
55516    ;
55517    if (element.hasValidCodedValueSet()) {
55518      composeReference("validCodedValueSet", element.getValidCodedValueSet());
55519    }
55520    if (element.hasNormalCodedValueSet()) {
55521      composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
55522    }
55523    if (element.hasAbnormalCodedValueSet()) {
55524      composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
55525    }
55526    if (element.hasCriticalCodedValueSet()) {
55527      composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
55528    }
55529  }
55530
55531  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name,
55532      ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
55533    if (element != null) {
55534      open(name);
55535      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
55536      close();
55537    }
55538  }
55539
55540  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(
55541      ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
55542    composeBackbone(element);
55543    if (element.hasCustomaryUnit()) {
55544      composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
55545    }
55546    if (element.hasUnit()) {
55547      composeCodeableConcept("unit", element.getUnit());
55548    }
55549    if (element.hasConversionFactorElement()) {
55550      composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
55551      composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
55552    }
55553    if (element.hasDecimalPrecisionElement()) {
55554      composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
55555      composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
55556    }
55557  }
55558
55559  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name,
55560      ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
55561    if (element != null) {
55562      open(name);
55563      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
55564      close();
55565    }
55566  }
55567
55568  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(
55569      ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
55570    composeBackbone(element);
55571    if (element.hasCategoryElement()) {
55572      composeEnumerationCore("category", element.getCategoryElement(),
55573          new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
55574      composeEnumerationExtras("category", element.getCategoryElement(),
55575          new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
55576    }
55577    if (element.hasRange()) {
55578      composeRange("range", element.getRange());
55579    }
55580    if (element.hasContext()) {
55581      composeCodeableConcept("context", element.getContext());
55582    }
55583    if (element.hasAppliesTo()) {
55584      openArray("appliesTo");
55585      for (CodeableConcept e : element.getAppliesTo())
55586        composeCodeableConcept(null, e);
55587      closeArray();
55588    }
55589    ;
55590    if (element.hasGenderElement()) {
55591      composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
55592          false);
55593      composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
55594          false);
55595    }
55596    if (element.hasAge()) {
55597      composeRange("age", element.getAge());
55598    }
55599    if (element.hasGestationalAge()) {
55600      composeRange("gestationalAge", element.getGestationalAge());
55601    }
55602    if (element.hasConditionElement()) {
55603      composeStringCore("condition", element.getConditionElement(), false);
55604      composeStringExtras("condition", element.getConditionElement(), false);
55605    }
55606  }
55607
55608  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
55609    if (element != null) {
55610      prop("resourceType", name);
55611      composeOperationDefinitionInner(element);
55612    }
55613  }
55614
55615  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
55616    composeDomainResourceElements(element);
55617    if (element.hasUrlElement()) {
55618      composeUriCore("url", element.getUrlElement(), false);
55619      composeUriExtras("url", element.getUrlElement(), false);
55620    }
55621    if (element.hasVersionElement()) {
55622      composeStringCore("version", element.getVersionElement(), false);
55623      composeStringExtras("version", element.getVersionElement(), false);
55624    }
55625    if (element.hasNameElement()) {
55626      composeStringCore("name", element.getNameElement(), false);
55627      composeStringExtras("name", element.getNameElement(), false);
55628    }
55629    if (element.hasTitleElement()) {
55630      composeStringCore("title", element.getTitleElement(), false);
55631      composeStringExtras("title", element.getTitleElement(), false);
55632    }
55633    if (element.hasStatusElement()) {
55634      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
55635          false);
55636      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
55637          false);
55638    }
55639    if (element.hasKindElement()) {
55640      composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(),
55641          false);
55642      composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(),
55643          false);
55644    }
55645    if (element.hasExperimentalElement()) {
55646      composeBooleanCore("experimental", element.getExperimentalElement(), false);
55647      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55648    }
55649    if (element.hasDateElement()) {
55650      composeDateTimeCore("date", element.getDateElement(), false);
55651      composeDateTimeExtras("date", element.getDateElement(), false);
55652    }
55653    if (element.hasPublisherElement()) {
55654      composeStringCore("publisher", element.getPublisherElement(), false);
55655      composeStringExtras("publisher", element.getPublisherElement(), false);
55656    }
55657    if (element.hasContact()) {
55658      openArray("contact");
55659      for (ContactDetail e : element.getContact())
55660        composeContactDetail(null, e);
55661      closeArray();
55662    }
55663    ;
55664    if (element.hasDescriptionElement()) {
55665      composeMarkdownCore("description", element.getDescriptionElement(), false);
55666      composeMarkdownExtras("description", element.getDescriptionElement(), false);
55667    }
55668    if (element.hasUseContext()) {
55669      openArray("useContext");
55670      for (UsageContext e : element.getUseContext())
55671        composeUsageContext(null, e);
55672      closeArray();
55673    }
55674    ;
55675    if (element.hasJurisdiction()) {
55676      openArray("jurisdiction");
55677      for (CodeableConcept e : element.getJurisdiction())
55678        composeCodeableConcept(null, e);
55679      closeArray();
55680    }
55681    ;
55682    if (element.hasPurposeElement()) {
55683      composeMarkdownCore("purpose", element.getPurposeElement(), false);
55684      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55685    }
55686    if (element.hasAffectsStateElement()) {
55687      composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
55688      composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
55689    }
55690    if (element.hasCodeElement()) {
55691      composeCodeCore("code", element.getCodeElement(), false);
55692      composeCodeExtras("code", element.getCodeElement(), false);
55693    }
55694    if (element.hasCommentElement()) {
55695      composeMarkdownCore("comment", element.getCommentElement(), false);
55696      composeMarkdownExtras("comment", element.getCommentElement(), false);
55697    }
55698    if (element.hasBaseElement()) {
55699      composeCanonicalCore("base", element.getBaseElement(), false);
55700      composeCanonicalExtras("base", element.getBaseElement(), false);
55701    }
55702    if (element.hasResource()) {
55703      openArray("resource");
55704      for (CodeType e : element.getResource())
55705        composeCodeCore(null, e, true);
55706      closeArray();
55707      if (anyHasExtras(element.getResource())) {
55708        openArray("_resource");
55709        for (CodeType e : element.getResource())
55710          composeCodeExtras(null, e, true);
55711        closeArray();
55712      }
55713    }
55714    ;
55715    if (element.hasSystemElement()) {
55716      composeBooleanCore("system", element.getSystemElement(), false);
55717      composeBooleanExtras("system", element.getSystemElement(), false);
55718    }
55719    if (element.hasTypeElement()) {
55720      composeBooleanCore("type", element.getTypeElement(), false);
55721      composeBooleanExtras("type", element.getTypeElement(), false);
55722    }
55723    if (element.hasInstanceElement()) {
55724      composeBooleanCore("instance", element.getInstanceElement(), false);
55725      composeBooleanExtras("instance", element.getInstanceElement(), false);
55726    }
55727    if (element.hasInputProfileElement()) {
55728      composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
55729      composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
55730    }
55731    if (element.hasOutputProfileElement()) {
55732      composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
55733      composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
55734    }
55735    if (element.hasParameter()) {
55736      openArray("parameter");
55737      for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter())
55738        composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
55739      closeArray();
55740    }
55741    ;
55742    if (element.hasOverload()) {
55743      openArray("overload");
55744      for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload())
55745        composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
55746      closeArray();
55747    }
55748    ;
55749  }
55750
55751  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name,
55752      OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
55753    if (element != null) {
55754      open(name);
55755      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
55756      close();
55757    }
55758  }
55759
55760  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(
55761      OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
55762    composeBackbone(element);
55763    if (element.hasNameElement()) {
55764      composeCodeCore("name", element.getNameElement(), false);
55765      composeCodeExtras("name", element.getNameElement(), false);
55766    }
55767    if (element.hasUseElement()) {
55768      composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(),
55769          false);
55770      composeEnumerationExtras("use", element.getUseElement(),
55771          new OperationDefinition.OperationParameterUseEnumFactory(), false);
55772    }
55773    if (element.hasMinElement()) {
55774      composeIntegerCore("min", element.getMinElement(), false);
55775      composeIntegerExtras("min", element.getMinElement(), false);
55776    }
55777    if (element.hasMaxElement()) {
55778      composeStringCore("max", element.getMaxElement(), false);
55779      composeStringExtras("max", element.getMaxElement(), false);
55780    }
55781    if (element.hasDocumentationElement()) {
55782      composeStringCore("documentation", element.getDocumentationElement(), false);
55783      composeStringExtras("documentation", element.getDocumentationElement(), false);
55784    }
55785    if (element.hasTypeElement()) {
55786      composeCodeCore("type", element.getTypeElement(), false);
55787      composeCodeExtras("type", element.getTypeElement(), false);
55788    }
55789    if (element.hasTargetProfile()) {
55790      openArray("targetProfile");
55791      for (CanonicalType e : element.getTargetProfile())
55792        composeCanonicalCore(null, e, true);
55793      closeArray();
55794      if (anyHasExtras(element.getTargetProfile())) {
55795        openArray("_targetProfile");
55796        for (CanonicalType e : element.getTargetProfile())
55797          composeCanonicalExtras(null, e, true);
55798        closeArray();
55799      }
55800    }
55801    ;
55802    if (element.hasSearchTypeElement()) {
55803      composeEnumerationCore("searchType", element.getSearchTypeElement(),
55804          new Enumerations.SearchParamTypeEnumFactory(), false);
55805      composeEnumerationExtras("searchType", element.getSearchTypeElement(),
55806          new Enumerations.SearchParamTypeEnumFactory(), false);
55807    }
55808    if (element.hasBinding()) {
55809      composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
55810    }
55811    if (element.hasReferencedFrom()) {
55812      openArray("referencedFrom");
55813      for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom())
55814        composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(null, e);
55815      closeArray();
55816    }
55817    ;
55818    if (element.hasPart()) {
55819      openArray("part");
55820      for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart())
55821        composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
55822      closeArray();
55823    }
55824    ;
55825  }
55826
55827  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name,
55828      OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
55829    if (element != null) {
55830      open(name);
55831      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
55832      close();
55833    }
55834  }
55835
55836  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(
55837      OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
55838    composeBackbone(element);
55839    if (element.hasStrengthElement()) {
55840      composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(),
55841          false);
55842      composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(),
55843          false);
55844    }
55845    if (element.hasValueSetElement()) {
55846      composeCanonicalCore("valueSet", element.getValueSetElement(), false);
55847      composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
55848    }
55849  }
55850
55851  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name,
55852      OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
55853    if (element != null) {
55854      open(name);
55855      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(element);
55856      close();
55857    }
55858  }
55859
55860  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(
55861      OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
55862    composeBackbone(element);
55863    if (element.hasSourceElement()) {
55864      composeStringCore("source", element.getSourceElement(), false);
55865      composeStringExtras("source", element.getSourceElement(), false);
55866    }
55867    if (element.hasSourceIdElement()) {
55868      composeStringCore("sourceId", element.getSourceIdElement(), false);
55869      composeStringExtras("sourceId", element.getSourceIdElement(), false);
55870    }
55871  }
55872
55873  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name,
55874      OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
55875    if (element != null) {
55876      open(name);
55877      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
55878      close();
55879    }
55880  }
55881
55882  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(
55883      OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
55884    composeBackbone(element);
55885    if (element.hasParameterName()) {
55886      openArray("parameterName");
55887      for (StringType e : element.getParameterName())
55888        composeStringCore(null, e, true);
55889      closeArray();
55890      if (anyHasExtras(element.getParameterName())) {
55891        openArray("_parameterName");
55892        for (StringType e : element.getParameterName())
55893          composeStringExtras(null, e, true);
55894        closeArray();
55895      }
55896    }
55897    ;
55898    if (element.hasCommentElement()) {
55899      composeStringCore("comment", element.getCommentElement(), false);
55900      composeStringExtras("comment", element.getCommentElement(), false);
55901    }
55902  }
55903
55904  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
55905    if (element != null) {
55906      prop("resourceType", name);
55907      composeOperationOutcomeInner(element);
55908    }
55909  }
55910
55911  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
55912    composeDomainResourceElements(element);
55913    if (element.hasIssue()) {
55914      openArray("issue");
55915      for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue())
55916        composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
55917      closeArray();
55918    }
55919    ;
55920  }
55921
55922  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name,
55923      OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
55924    if (element != null) {
55925      open(name);
55926      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
55927      close();
55928    }
55929  }
55930
55931  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(
55932      OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
55933    composeBackbone(element);
55934    if (element.hasSeverityElement()) {
55935      composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(),
55936          false);
55937      composeEnumerationExtras("severity", element.getSeverityElement(),
55938          new OperationOutcome.IssueSeverityEnumFactory(), false);
55939    }
55940    if (element.hasCodeElement()) {
55941      composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
55942      composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
55943    }
55944    if (element.hasDetails()) {
55945      composeCodeableConcept("details", element.getDetails());
55946    }
55947    if (element.hasDiagnosticsElement()) {
55948      composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
55949      composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
55950    }
55951    if (element.hasLocation()) {
55952      openArray("location");
55953      for (StringType e : element.getLocation())
55954        composeStringCore(null, e, true);
55955      closeArray();
55956      if (anyHasExtras(element.getLocation())) {
55957        openArray("_location");
55958        for (StringType e : element.getLocation())
55959          composeStringExtras(null, e, true);
55960        closeArray();
55961      }
55962    }
55963    ;
55964    if (element.hasExpression()) {
55965      openArray("expression");
55966      for (StringType e : element.getExpression())
55967        composeStringCore(null, e, true);
55968      closeArray();
55969      if (anyHasExtras(element.getExpression())) {
55970        openArray("_expression");
55971        for (StringType e : element.getExpression())
55972          composeStringExtras(null, e, true);
55973        closeArray();
55974      }
55975    }
55976    ;
55977  }
55978
55979  protected void composeOrganization(String name, Organization element) throws IOException {
55980    if (element != null) {
55981      prop("resourceType", name);
55982      composeOrganizationInner(element);
55983    }
55984  }
55985
55986  protected void composeOrganizationInner(Organization element) throws IOException {
55987    composeDomainResourceElements(element);
55988    if (element.hasIdentifier()) {
55989      openArray("identifier");
55990      for (Identifier e : element.getIdentifier())
55991        composeIdentifier(null, e);
55992      closeArray();
55993    }
55994    ;
55995    if (element.hasActiveElement()) {
55996      composeBooleanCore("active", element.getActiveElement(), false);
55997      composeBooleanExtras("active", element.getActiveElement(), false);
55998    }
55999    if (element.hasType()) {
56000      openArray("type");
56001      for (CodeableConcept e : element.getType())
56002        composeCodeableConcept(null, e);
56003      closeArray();
56004    }
56005    ;
56006    if (element.hasNameElement()) {
56007      composeStringCore("name", element.getNameElement(), false);
56008      composeStringExtras("name", element.getNameElement(), false);
56009    }
56010    if (element.hasAlias()) {
56011      openArray("alias");
56012      for (StringType e : element.getAlias())
56013        composeStringCore(null, e, true);
56014      closeArray();
56015      if (anyHasExtras(element.getAlias())) {
56016        openArray("_alias");
56017        for (StringType e : element.getAlias())
56018          composeStringExtras(null, e, true);
56019        closeArray();
56020      }
56021    }
56022    ;
56023    if (element.hasTelecom()) {
56024      openArray("telecom");
56025      for (ContactPoint e : element.getTelecom())
56026        composeContactPoint(null, e);
56027      closeArray();
56028    }
56029    ;
56030    if (element.hasAddress()) {
56031      openArray("address");
56032      for (Address e : element.getAddress())
56033        composeAddress(null, e);
56034      closeArray();
56035    }
56036    ;
56037    if (element.hasPartOf()) {
56038      composeReference("partOf", element.getPartOf());
56039    }
56040    if (element.hasContact()) {
56041      openArray("contact");
56042      for (Organization.OrganizationContactComponent e : element.getContact())
56043        composeOrganizationOrganizationContactComponent(null, e);
56044      closeArray();
56045    }
56046    ;
56047    if (element.hasEndpoint()) {
56048      openArray("endpoint");
56049      for (Reference e : element.getEndpoint())
56050        composeReference(null, e);
56051      closeArray();
56052    }
56053    ;
56054  }
56055
56056  protected void composeOrganizationOrganizationContactComponent(String name,
56057      Organization.OrganizationContactComponent element) throws IOException {
56058    if (element != null) {
56059      open(name);
56060      composeOrganizationOrganizationContactComponentInner(element);
56061      close();
56062    }
56063  }
56064
56065  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element)
56066      throws IOException {
56067    composeBackbone(element);
56068    if (element.hasPurpose()) {
56069      composeCodeableConcept("purpose", element.getPurpose());
56070    }
56071    if (element.hasName()) {
56072      composeHumanName("name", element.getName());
56073    }
56074    if (element.hasTelecom()) {
56075      openArray("telecom");
56076      for (ContactPoint e : element.getTelecom())
56077        composeContactPoint(null, e);
56078      closeArray();
56079    }
56080    ;
56081    if (element.hasAddress()) {
56082      composeAddress("address", element.getAddress());
56083    }
56084  }
56085
56086  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
56087    if (element != null) {
56088      prop("resourceType", name);
56089      composeOrganizationAffiliationInner(element);
56090    }
56091  }
56092
56093  protected void composeOrganizationAffiliationInner(OrganizationAffiliation element) throws IOException {
56094    composeDomainResourceElements(element);
56095    if (element.hasIdentifier()) {
56096      openArray("identifier");
56097      for (Identifier e : element.getIdentifier())
56098        composeIdentifier(null, e);
56099      closeArray();
56100    }
56101    ;
56102    if (element.hasActiveElement()) {
56103      composeBooleanCore("active", element.getActiveElement(), false);
56104      composeBooleanExtras("active", element.getActiveElement(), false);
56105    }
56106    if (element.hasPeriod()) {
56107      composePeriod("period", element.getPeriod());
56108    }
56109    if (element.hasOrganization()) {
56110      composeReference("organization", element.getOrganization());
56111    }
56112    if (element.hasParticipatingOrganization()) {
56113      composeReference("participatingOrganization", element.getParticipatingOrganization());
56114    }
56115    if (element.hasNetwork()) {
56116      openArray("network");
56117      for (Reference e : element.getNetwork())
56118        composeReference(null, e);
56119      closeArray();
56120    }
56121    ;
56122    if (element.hasCode()) {
56123      openArray("code");
56124      for (CodeableConcept e : element.getCode())
56125        composeCodeableConcept(null, e);
56126      closeArray();
56127    }
56128    ;
56129    if (element.hasSpecialty()) {
56130      openArray("specialty");
56131      for (CodeableConcept e : element.getSpecialty())
56132        composeCodeableConcept(null, e);
56133      closeArray();
56134    }
56135    ;
56136    if (element.hasLocation()) {
56137      openArray("location");
56138      for (Reference e : element.getLocation())
56139        composeReference(null, e);
56140      closeArray();
56141    }
56142    ;
56143    if (element.hasHealthcareService()) {
56144      openArray("healthcareService");
56145      for (Reference e : element.getHealthcareService())
56146        composeReference(null, e);
56147      closeArray();
56148    }
56149    ;
56150    if (element.hasTelecom()) {
56151      openArray("telecom");
56152      for (ContactPoint e : element.getTelecom())
56153        composeContactPoint(null, e);
56154      closeArray();
56155    }
56156    ;
56157    if (element.hasEndpoint()) {
56158      openArray("endpoint");
56159      for (Reference e : element.getEndpoint())
56160        composeReference(null, e);
56161      closeArray();
56162    }
56163    ;
56164  }
56165
56166  protected void composePatient(String name, Patient element) throws IOException {
56167    if (element != null) {
56168      prop("resourceType", name);
56169      composePatientInner(element);
56170    }
56171  }
56172
56173  protected void composePatientInner(Patient element) throws IOException {
56174    composeDomainResourceElements(element);
56175    if (element.hasIdentifier()) {
56176      openArray("identifier");
56177      for (Identifier e : element.getIdentifier())
56178        composeIdentifier(null, e);
56179      closeArray();
56180    }
56181    ;
56182    if (element.hasActiveElement()) {
56183      composeBooleanCore("active", element.getActiveElement(), false);
56184      composeBooleanExtras("active", element.getActiveElement(), false);
56185    }
56186    if (element.hasName()) {
56187      openArray("name");
56188      for (HumanName e : element.getName())
56189        composeHumanName(null, e);
56190      closeArray();
56191    }
56192    ;
56193    if (element.hasTelecom()) {
56194      openArray("telecom");
56195      for (ContactPoint e : element.getTelecom())
56196        composeContactPoint(null, e);
56197      closeArray();
56198    }
56199    ;
56200    if (element.hasGenderElement()) {
56201      composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
56202          false);
56203      composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
56204          false);
56205    }
56206    if (element.hasBirthDateElement()) {
56207      composeDateCore("birthDate", element.getBirthDateElement(), false);
56208      composeDateExtras("birthDate", element.getBirthDateElement(), false);
56209    }
56210    if (element.hasDeceased()) {
56211      composeType("deceased", element.getDeceased());
56212    }
56213    if (element.hasAddress()) {
56214      openArray("address");
56215      for (Address e : element.getAddress())
56216        composeAddress(null, e);
56217      closeArray();
56218    }
56219    ;
56220    if (element.hasMaritalStatus()) {
56221      composeCodeableConcept("maritalStatus", element.getMaritalStatus());
56222    }
56223    if (element.hasMultipleBirth()) {
56224      composeType("multipleBirth", element.getMultipleBirth());
56225    }
56226    if (element.hasPhoto()) {
56227      openArray("photo");
56228      for (Attachment e : element.getPhoto())
56229        composeAttachment(null, e);
56230      closeArray();
56231    }
56232    ;
56233    if (element.hasContact()) {
56234      openArray("contact");
56235      for (Patient.ContactComponent e : element.getContact())
56236        composePatientContactComponent(null, e);
56237      closeArray();
56238    }
56239    ;
56240    if (element.hasCommunication()) {
56241      openArray("communication");
56242      for (Patient.PatientCommunicationComponent e : element.getCommunication())
56243        composePatientPatientCommunicationComponent(null, e);
56244      closeArray();
56245    }
56246    ;
56247    if (element.hasGeneralPractitioner()) {
56248      openArray("generalPractitioner");
56249      for (Reference e : element.getGeneralPractitioner())
56250        composeReference(null, e);
56251      closeArray();
56252    }
56253    ;
56254    if (element.hasManagingOrganization()) {
56255      composeReference("managingOrganization", element.getManagingOrganization());
56256    }
56257    if (element.hasLink()) {
56258      openArray("link");
56259      for (Patient.PatientLinkComponent e : element.getLink())
56260        composePatientPatientLinkComponent(null, e);
56261      closeArray();
56262    }
56263    ;
56264  }
56265
56266  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
56267    if (element != null) {
56268      open(name);
56269      composePatientContactComponentInner(element);
56270      close();
56271    }
56272  }
56273
56274  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
56275    composeBackbone(element);
56276    if (element.hasRelationship()) {
56277      openArray("relationship");
56278      for (CodeableConcept e : element.getRelationship())
56279        composeCodeableConcept(null, e);
56280      closeArray();
56281    }
56282    ;
56283    if (element.hasName()) {
56284      composeHumanName("name", element.getName());
56285    }
56286    if (element.hasTelecom()) {
56287      openArray("telecom");
56288      for (ContactPoint e : element.getTelecom())
56289        composeContactPoint(null, e);
56290      closeArray();
56291    }
56292    ;
56293    if (element.hasAddress()) {
56294      composeAddress("address", element.getAddress());
56295    }
56296    if (element.hasGenderElement()) {
56297      composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
56298          false);
56299      composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
56300          false);
56301    }
56302    if (element.hasOrganization()) {
56303      composeReference("organization", element.getOrganization());
56304    }
56305    if (element.hasPeriod()) {
56306      composePeriod("period", element.getPeriod());
56307    }
56308  }
56309
56310  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element)
56311      throws IOException {
56312    if (element != null) {
56313      open(name);
56314      composePatientPatientCommunicationComponentInner(element);
56315      close();
56316    }
56317  }
56318
56319  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element)
56320      throws IOException {
56321    composeBackbone(element);
56322    if (element.hasLanguage()) {
56323      composeCodeableConcept("language", element.getLanguage());
56324    }
56325    if (element.hasPreferredElement()) {
56326      composeBooleanCore("preferred", element.getPreferredElement(), false);
56327      composeBooleanExtras("preferred", element.getPreferredElement(), false);
56328    }
56329  }
56330
56331  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element)
56332      throws IOException {
56333    if (element != null) {
56334      open(name);
56335      composePatientPatientLinkComponentInner(element);
56336      close();
56337    }
56338  }
56339
56340  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
56341    composeBackbone(element);
56342    if (element.hasOther()) {
56343      composeReference("other", element.getOther());
56344    }
56345    if (element.hasTypeElement()) {
56346      composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
56347      composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
56348    }
56349  }
56350
56351  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
56352    if (element != null) {
56353      prop("resourceType", name);
56354      composePaymentNoticeInner(element);
56355    }
56356  }
56357
56358  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
56359    composeDomainResourceElements(element);
56360    if (element.hasIdentifier()) {
56361      openArray("identifier");
56362      for (Identifier e : element.getIdentifier())
56363        composeIdentifier(null, e);
56364      closeArray();
56365    }
56366    ;
56367    if (element.hasStatusElement()) {
56368      composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(),
56369          false);
56370      composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(),
56371          false);
56372    }
56373    if (element.hasRequest()) {
56374      composeReference("request", element.getRequest());
56375    }
56376    if (element.hasResponse()) {
56377      composeReference("response", element.getResponse());
56378    }
56379    if (element.hasCreatedElement()) {
56380      composeDateTimeCore("created", element.getCreatedElement(), false);
56381      composeDateTimeExtras("created", element.getCreatedElement(), false);
56382    }
56383    if (element.hasProvider()) {
56384      composeReference("provider", element.getProvider());
56385    }
56386    if (element.hasPayment()) {
56387      composeReference("payment", element.getPayment());
56388    }
56389    if (element.hasPaymentDateElement()) {
56390      composeDateCore("paymentDate", element.getPaymentDateElement(), false);
56391      composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
56392    }
56393    if (element.hasPayee()) {
56394      composeReference("payee", element.getPayee());
56395    }
56396    if (element.hasRecipient()) {
56397      composeReference("recipient", element.getRecipient());
56398    }
56399    if (element.hasAmount()) {
56400      composeMoney("amount", element.getAmount());
56401    }
56402    if (element.hasPaymentStatus()) {
56403      composeCodeableConcept("paymentStatus", element.getPaymentStatus());
56404    }
56405  }
56406
56407  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
56408    if (element != null) {
56409      prop("resourceType", name);
56410      composePaymentReconciliationInner(element);
56411    }
56412  }
56413
56414  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
56415    composeDomainResourceElements(element);
56416    if (element.hasIdentifier()) {
56417      openArray("identifier");
56418      for (Identifier e : element.getIdentifier())
56419        composeIdentifier(null, e);
56420      closeArray();
56421    }
56422    ;
56423    if (element.hasStatusElement()) {
56424      composeEnumerationCore("status", element.getStatusElement(),
56425          new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
56426      composeEnumerationExtras("status", element.getStatusElement(),
56427          new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
56428    }
56429    if (element.hasPeriod()) {
56430      composePeriod("period", element.getPeriod());
56431    }
56432    if (element.hasCreatedElement()) {
56433      composeDateTimeCore("created", element.getCreatedElement(), false);
56434      composeDateTimeExtras("created", element.getCreatedElement(), false);
56435    }
56436    if (element.hasPaymentIssuer()) {
56437      composeReference("paymentIssuer", element.getPaymentIssuer());
56438    }
56439    if (element.hasRequest()) {
56440      composeReference("request", element.getRequest());
56441    }
56442    if (element.hasRequestor()) {
56443      composeReference("requestor", element.getRequestor());
56444    }
56445    if (element.hasOutcomeElement()) {
56446      composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(),
56447          false);
56448      composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(),
56449          false);
56450    }
56451    if (element.hasDispositionElement()) {
56452      composeStringCore("disposition", element.getDispositionElement(), false);
56453      composeStringExtras("disposition", element.getDispositionElement(), false);
56454    }
56455    if (element.hasPaymentDateElement()) {
56456      composeDateCore("paymentDate", element.getPaymentDateElement(), false);
56457      composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
56458    }
56459    if (element.hasPaymentAmount()) {
56460      composeMoney("paymentAmount", element.getPaymentAmount());
56461    }
56462    if (element.hasPaymentIdentifier()) {
56463      composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
56464    }
56465    if (element.hasDetail()) {
56466      openArray("detail");
56467      for (PaymentReconciliation.DetailsComponent e : element.getDetail())
56468        composePaymentReconciliationDetailsComponent(null, e);
56469      closeArray();
56470    }
56471    ;
56472    if (element.hasFormCode()) {
56473      composeCodeableConcept("formCode", element.getFormCode());
56474    }
56475    if (element.hasProcessNote()) {
56476      openArray("processNote");
56477      for (PaymentReconciliation.NotesComponent e : element.getProcessNote())
56478        composePaymentReconciliationNotesComponent(null, e);
56479      closeArray();
56480    }
56481    ;
56482  }
56483
56484  protected void composePaymentReconciliationDetailsComponent(String name,
56485      PaymentReconciliation.DetailsComponent element) throws IOException {
56486    if (element != null) {
56487      open(name);
56488      composePaymentReconciliationDetailsComponentInner(element);
56489      close();
56490    }
56491  }
56492
56493  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element)
56494      throws IOException {
56495    composeBackbone(element);
56496    if (element.hasIdentifier()) {
56497      composeIdentifier("identifier", element.getIdentifier());
56498    }
56499    if (element.hasPredecessor()) {
56500      composeIdentifier("predecessor", element.getPredecessor());
56501    }
56502    if (element.hasType()) {
56503      composeCodeableConcept("type", element.getType());
56504    }
56505    if (element.hasRequest()) {
56506      composeReference("request", element.getRequest());
56507    }
56508    if (element.hasSubmitter()) {
56509      composeReference("submitter", element.getSubmitter());
56510    }
56511    if (element.hasResponse()) {
56512      composeReference("response", element.getResponse());
56513    }
56514    if (element.hasDateElement()) {
56515      composeDateCore("date", element.getDateElement(), false);
56516      composeDateExtras("date", element.getDateElement(), false);
56517    }
56518    if (element.hasResponsible()) {
56519      composeReference("responsible", element.getResponsible());
56520    }
56521    if (element.hasPayee()) {
56522      composeReference("payee", element.getPayee());
56523    }
56524    if (element.hasAmount()) {
56525      composeMoney("amount", element.getAmount());
56526    }
56527  }
56528
56529  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element)
56530      throws IOException {
56531    if (element != null) {
56532      open(name);
56533      composePaymentReconciliationNotesComponentInner(element);
56534      close();
56535    }
56536  }
56537
56538  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element)
56539      throws IOException {
56540    composeBackbone(element);
56541    if (element.hasTypeElement()) {
56542      composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
56543      composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
56544    }
56545    if (element.hasTextElement()) {
56546      composeStringCore("text", element.getTextElement(), false);
56547      composeStringExtras("text", element.getTextElement(), false);
56548    }
56549  }
56550
56551  protected void composePerson(String name, Person element) throws IOException {
56552    if (element != null) {
56553      prop("resourceType", name);
56554      composePersonInner(element);
56555    }
56556  }
56557
56558  protected void composePersonInner(Person element) throws IOException {
56559    composeDomainResourceElements(element);
56560    if (element.hasIdentifier()) {
56561      openArray("identifier");
56562      for (Identifier e : element.getIdentifier())
56563        composeIdentifier(null, e);
56564      closeArray();
56565    }
56566    ;
56567    if (element.hasName()) {
56568      openArray("name");
56569      for (HumanName e : element.getName())
56570        composeHumanName(null, e);
56571      closeArray();
56572    }
56573    ;
56574    if (element.hasTelecom()) {
56575      openArray("telecom");
56576      for (ContactPoint e : element.getTelecom())
56577        composeContactPoint(null, e);
56578      closeArray();
56579    }
56580    ;
56581    if (element.hasGenderElement()) {
56582      composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
56583          false);
56584      composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
56585          false);
56586    }
56587    if (element.hasBirthDateElement()) {
56588      composeDateCore("birthDate", element.getBirthDateElement(), false);
56589      composeDateExtras("birthDate", element.getBirthDateElement(), false);
56590    }
56591    if (element.hasAddress()) {
56592      openArray("address");
56593      for (Address e : element.getAddress())
56594        composeAddress(null, e);
56595      closeArray();
56596    }
56597    ;
56598    if (element.hasPhoto()) {
56599      composeAttachment("photo", element.getPhoto());
56600    }
56601    if (element.hasManagingOrganization()) {
56602      composeReference("managingOrganization", element.getManagingOrganization());
56603    }
56604    if (element.hasActiveElement()) {
56605      composeBooleanCore("active", element.getActiveElement(), false);
56606      composeBooleanExtras("active", element.getActiveElement(), false);
56607    }
56608    if (element.hasLink()) {
56609      openArray("link");
56610      for (Person.PersonLinkComponent e : element.getLink())
56611        composePersonPersonLinkComponent(null, e);
56612      closeArray();
56613    }
56614    ;
56615  }
56616
56617  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
56618    if (element != null) {
56619      open(name);
56620      composePersonPersonLinkComponentInner(element);
56621      close();
56622    }
56623  }
56624
56625  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
56626    composeBackbone(element);
56627    if (element.hasTarget()) {
56628      composeReference("target", element.getTarget());
56629    }
56630    if (element.hasAssuranceElement()) {
56631      composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(),
56632          false);
56633      composeEnumerationExtras("assurance", element.getAssuranceElement(),
56634          new Person.IdentityAssuranceLevelEnumFactory(), false);
56635    }
56636  }
56637
56638  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
56639    if (element != null) {
56640      prop("resourceType", name);
56641      composePlanDefinitionInner(element);
56642    }
56643  }
56644
56645  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
56646    composeDomainResourceElements(element);
56647    if (element.hasUrlElement()) {
56648      composeUriCore("url", element.getUrlElement(), false);
56649      composeUriExtras("url", element.getUrlElement(), false);
56650    }
56651    if (element.hasIdentifier()) {
56652      openArray("identifier");
56653      for (Identifier e : element.getIdentifier())
56654        composeIdentifier(null, e);
56655      closeArray();
56656    }
56657    ;
56658    if (element.hasVersionElement()) {
56659      composeStringCore("version", element.getVersionElement(), false);
56660      composeStringExtras("version", element.getVersionElement(), false);
56661    }
56662    if (element.hasNameElement()) {
56663      composeStringCore("name", element.getNameElement(), false);
56664      composeStringExtras("name", element.getNameElement(), false);
56665    }
56666    if (element.hasTitleElement()) {
56667      composeStringCore("title", element.getTitleElement(), false);
56668      composeStringExtras("title", element.getTitleElement(), false);
56669    }
56670    if (element.hasSubtitleElement()) {
56671      composeStringCore("subtitle", element.getSubtitleElement(), false);
56672      composeStringExtras("subtitle", element.getSubtitleElement(), false);
56673    }
56674    if (element.hasType()) {
56675      composeCodeableConcept("type", element.getType());
56676    }
56677    if (element.hasStatusElement()) {
56678      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
56679          false);
56680      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
56681          false);
56682    }
56683    if (element.hasExperimentalElement()) {
56684      composeBooleanCore("experimental", element.getExperimentalElement(), false);
56685      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56686    }
56687    if (element.hasSubject()) {
56688      composeType("subject", element.getSubject());
56689    }
56690    if (element.hasDateElement()) {
56691      composeDateTimeCore("date", element.getDateElement(), false);
56692      composeDateTimeExtras("date", element.getDateElement(), false);
56693    }
56694    if (element.hasPublisherElement()) {
56695      composeStringCore("publisher", element.getPublisherElement(), false);
56696      composeStringExtras("publisher", element.getPublisherElement(), false);
56697    }
56698    if (element.hasContact()) {
56699      openArray("contact");
56700      for (ContactDetail e : element.getContact())
56701        composeContactDetail(null, e);
56702      closeArray();
56703    }
56704    ;
56705    if (element.hasDescriptionElement()) {
56706      composeMarkdownCore("description", element.getDescriptionElement(), false);
56707      composeMarkdownExtras("description", element.getDescriptionElement(), false);
56708    }
56709    if (element.hasUseContext()) {
56710      openArray("useContext");
56711      for (UsageContext e : element.getUseContext())
56712        composeUsageContext(null, e);
56713      closeArray();
56714    }
56715    ;
56716    if (element.hasJurisdiction()) {
56717      openArray("jurisdiction");
56718      for (CodeableConcept e : element.getJurisdiction())
56719        composeCodeableConcept(null, e);
56720      closeArray();
56721    }
56722    ;
56723    if (element.hasPurposeElement()) {
56724      composeMarkdownCore("purpose", element.getPurposeElement(), false);
56725      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56726    }
56727    if (element.hasUsageElement()) {
56728      composeStringCore("usage", element.getUsageElement(), false);
56729      composeStringExtras("usage", element.getUsageElement(), false);
56730    }
56731    if (element.hasCopyrightElement()) {
56732      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56733      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56734    }
56735    if (element.hasApprovalDateElement()) {
56736      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
56737      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
56738    }
56739    if (element.hasLastReviewDateElement()) {
56740      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
56741      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
56742    }
56743    if (element.hasEffectivePeriod()) {
56744      composePeriod("effectivePeriod", element.getEffectivePeriod());
56745    }
56746    if (element.hasTopic()) {
56747      openArray("topic");
56748      for (CodeableConcept e : element.getTopic())
56749        composeCodeableConcept(null, e);
56750      closeArray();
56751    }
56752    ;
56753    if (element.hasAuthor()) {
56754      openArray("author");
56755      for (ContactDetail e : element.getAuthor())
56756        composeContactDetail(null, e);
56757      closeArray();
56758    }
56759    ;
56760    if (element.hasEditor()) {
56761      openArray("editor");
56762      for (ContactDetail e : element.getEditor())
56763        composeContactDetail(null, e);
56764      closeArray();
56765    }
56766    ;
56767    if (element.hasReviewer()) {
56768      openArray("reviewer");
56769      for (ContactDetail e : element.getReviewer())
56770        composeContactDetail(null, e);
56771      closeArray();
56772    }
56773    ;
56774    if (element.hasEndorser()) {
56775      openArray("endorser");
56776      for (ContactDetail e : element.getEndorser())
56777        composeContactDetail(null, e);
56778      closeArray();
56779    }
56780    ;
56781    if (element.hasRelatedArtifact()) {
56782      openArray("relatedArtifact");
56783      for (RelatedArtifact e : element.getRelatedArtifact())
56784        composeRelatedArtifact(null, e);
56785      closeArray();
56786    }
56787    ;
56788    if (element.hasLibrary()) {
56789      openArray("library");
56790      for (CanonicalType e : element.getLibrary())
56791        composeCanonicalCore(null, e, true);
56792      closeArray();
56793      if (anyHasExtras(element.getLibrary())) {
56794        openArray("_library");
56795        for (CanonicalType e : element.getLibrary())
56796          composeCanonicalExtras(null, e, true);
56797        closeArray();
56798      }
56799    }
56800    ;
56801    if (element.hasGoal()) {
56802      openArray("goal");
56803      for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal())
56804        composePlanDefinitionPlanDefinitionGoalComponent(null, e);
56805      closeArray();
56806    }
56807    ;
56808    if (element.hasAction()) {
56809      openArray("action");
56810      for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction())
56811        composePlanDefinitionPlanDefinitionActionComponent(null, e);
56812      closeArray();
56813    }
56814    ;
56815  }
56816
56817  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name,
56818      PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
56819    if (element != null) {
56820      open(name);
56821      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
56822      close();
56823    }
56824  }
56825
56826  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(
56827      PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
56828    composeBackbone(element);
56829    if (element.hasCategory()) {
56830      composeCodeableConcept("category", element.getCategory());
56831    }
56832    if (element.hasDescription()) {
56833      composeCodeableConcept("description", element.getDescription());
56834    }
56835    if (element.hasPriority()) {
56836      composeCodeableConcept("priority", element.getPriority());
56837    }
56838    if (element.hasStart()) {
56839      composeCodeableConcept("start", element.getStart());
56840    }
56841    if (element.hasAddresses()) {
56842      openArray("addresses");
56843      for (CodeableConcept e : element.getAddresses())
56844        composeCodeableConcept(null, e);
56845      closeArray();
56846    }
56847    ;
56848    if (element.hasDocumentation()) {
56849      openArray("documentation");
56850      for (RelatedArtifact e : element.getDocumentation())
56851        composeRelatedArtifact(null, e);
56852      closeArray();
56853    }
56854    ;
56855    if (element.hasTarget()) {
56856      openArray("target");
56857      for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget())
56858        composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
56859      closeArray();
56860    }
56861    ;
56862  }
56863
56864  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name,
56865      PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
56866    if (element != null) {
56867      open(name);
56868      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
56869      close();
56870    }
56871  }
56872
56873  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(
56874      PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
56875    composeBackbone(element);
56876    if (element.hasMeasure()) {
56877      composeCodeableConcept("measure", element.getMeasure());
56878    }
56879    if (element.hasDetail()) {
56880      composeType("detail", element.getDetail());
56881    }
56882    if (element.hasDue()) {
56883      composeDuration("due", element.getDue());
56884    }
56885  }
56886
56887  protected void composePlanDefinitionPlanDefinitionActionComponent(String name,
56888      PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
56889    if (element != null) {
56890      open(name);
56891      composePlanDefinitionPlanDefinitionActionComponentInner(element);
56892      close();
56893    }
56894  }
56895
56896  protected void composePlanDefinitionPlanDefinitionActionComponentInner(
56897      PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
56898    composeBackbone(element);
56899    if (element.hasPrefixElement()) {
56900      composeStringCore("prefix", element.getPrefixElement(), false);
56901      composeStringExtras("prefix", element.getPrefixElement(), false);
56902    }
56903    if (element.hasTitleElement()) {
56904      composeStringCore("title", element.getTitleElement(), false);
56905      composeStringExtras("title", element.getTitleElement(), false);
56906    }
56907    if (element.hasDescriptionElement()) {
56908      composeStringCore("description", element.getDescriptionElement(), false);
56909      composeStringExtras("description", element.getDescriptionElement(), false);
56910    }
56911    if (element.hasTextEquivalentElement()) {
56912      composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
56913      composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
56914    }
56915    if (element.hasPriorityElement()) {
56916      composeEnumerationCore("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(),
56917          false);
56918      composeEnumerationExtras("priority", element.getPriorityElement(),
56919          new PlanDefinition.RequestPriorityEnumFactory(), false);
56920    }
56921    if (element.hasCode()) {
56922      openArray("code");
56923      for (CodeableConcept e : element.getCode())
56924        composeCodeableConcept(null, e);
56925      closeArray();
56926    }
56927    ;
56928    if (element.hasReason()) {
56929      openArray("reason");
56930      for (CodeableConcept e : element.getReason())
56931        composeCodeableConcept(null, e);
56932      closeArray();
56933    }
56934    ;
56935    if (element.hasDocumentation()) {
56936      openArray("documentation");
56937      for (RelatedArtifact e : element.getDocumentation())
56938        composeRelatedArtifact(null, e);
56939      closeArray();
56940    }
56941    ;
56942    if (element.hasGoalId()) {
56943      openArray("goalId");
56944      for (IdType e : element.getGoalId())
56945        composeIdCore(null, e, true);
56946      closeArray();
56947      if (anyHasExtras(element.getGoalId())) {
56948        openArray("_goalId");
56949        for (IdType e : element.getGoalId())
56950          composeIdExtras(null, e, true);
56951        closeArray();
56952      }
56953    }
56954    ;
56955    if (element.hasSubject()) {
56956      composeType("subject", element.getSubject());
56957    }
56958    if (element.hasTrigger()) {
56959      openArray("trigger");
56960      for (TriggerDefinition e : element.getTrigger())
56961        composeTriggerDefinition(null, e);
56962      closeArray();
56963    }
56964    ;
56965    if (element.hasCondition()) {
56966      openArray("condition");
56967      for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition())
56968        composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
56969      closeArray();
56970    }
56971    ;
56972    if (element.hasInput()) {
56973      openArray("input");
56974      for (DataRequirement e : element.getInput())
56975        composeDataRequirement(null, e);
56976      closeArray();
56977    }
56978    ;
56979    if (element.hasOutput()) {
56980      openArray("output");
56981      for (DataRequirement e : element.getOutput())
56982        composeDataRequirement(null, e);
56983      closeArray();
56984    }
56985    ;
56986    if (element.hasRelatedAction()) {
56987      openArray("relatedAction");
56988      for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction())
56989        composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
56990      closeArray();
56991    }
56992    ;
56993    if (element.hasTiming()) {
56994      composeType("timing", element.getTiming());
56995    }
56996    if (element.hasParticipant()) {
56997      openArray("participant");
56998      for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant())
56999        composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
57000      closeArray();
57001    }
57002    ;
57003    if (element.hasType()) {
57004      composeCodeableConcept("type", element.getType());
57005    }
57006    if (element.hasGroupingBehaviorElement()) {
57007      composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(),
57008          new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
57009      composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(),
57010          new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
57011    }
57012    if (element.hasSelectionBehaviorElement()) {
57013      composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(),
57014          new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
57015      composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(),
57016          new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
57017    }
57018    if (element.hasRequiredBehaviorElement()) {
57019      composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(),
57020          new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
57021      composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(),
57022          new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
57023    }
57024    if (element.hasPrecheckBehaviorElement()) {
57025      composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(),
57026          new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
57027      composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(),
57028          new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
57029    }
57030    if (element.hasCardinalityBehaviorElement()) {
57031      composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(),
57032          new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
57033      composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(),
57034          new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
57035    }
57036    if (element.hasDefinition()) {
57037      composeType("definition", element.getDefinition());
57038    }
57039    if (element.hasTransformElement()) {
57040      composeCanonicalCore("transform", element.getTransformElement(), false);
57041      composeCanonicalExtras("transform", element.getTransformElement(), false);
57042    }
57043    if (element.hasDynamicValue()) {
57044      openArray("dynamicValue");
57045      for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue())
57046        composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
57047      closeArray();
57048    }
57049    ;
57050    if (element.hasAction()) {
57051      openArray("action");
57052      for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction())
57053        composePlanDefinitionPlanDefinitionActionComponent(null, e);
57054      closeArray();
57055    }
57056    ;
57057  }
57058
57059  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name,
57060      PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
57061    if (element != null) {
57062      open(name);
57063      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
57064      close();
57065    }
57066  }
57067
57068  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(
57069      PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
57070    composeBackbone(element);
57071    if (element.hasKindElement()) {
57072      composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(),
57073          false);
57074      composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(),
57075          false);
57076    }
57077    if (element.hasExpression()) {
57078      composeExpression("expression", element.getExpression());
57079    }
57080  }
57081
57082  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name,
57083      PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
57084    if (element != null) {
57085      open(name);
57086      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
57087      close();
57088    }
57089  }
57090
57091  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(
57092      PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
57093    composeBackbone(element);
57094    if (element.hasActionIdElement()) {
57095      composeIdCore("actionId", element.getActionIdElement(), false);
57096      composeIdExtras("actionId", element.getActionIdElement(), false);
57097    }
57098    if (element.hasRelationshipElement()) {
57099      composeEnumerationCore("relationship", element.getRelationshipElement(),
57100          new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
57101      composeEnumerationExtras("relationship", element.getRelationshipElement(),
57102          new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
57103    }
57104    if (element.hasOffset()) {
57105      composeType("offset", element.getOffset());
57106    }
57107  }
57108
57109  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name,
57110      PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
57111    if (element != null) {
57112      open(name);
57113      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
57114      close();
57115    }
57116  }
57117
57118  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(
57119      PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
57120    composeBackbone(element);
57121    if (element.hasTypeElement()) {
57122      composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(),
57123          false);
57124      composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(),
57125          false);
57126    }
57127    if (element.hasRole()) {
57128      composeCodeableConcept("role", element.getRole());
57129    }
57130  }
57131
57132  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name,
57133      PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
57134    if (element != null) {
57135      open(name);
57136      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
57137      close();
57138    }
57139  }
57140
57141  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(
57142      PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
57143    composeBackbone(element);
57144    if (element.hasPathElement()) {
57145      composeStringCore("path", element.getPathElement(), false);
57146      composeStringExtras("path", element.getPathElement(), false);
57147    }
57148    if (element.hasExpression()) {
57149      composeExpression("expression", element.getExpression());
57150    }
57151  }
57152
57153  protected void composePractitioner(String name, Practitioner element) throws IOException {
57154    if (element != null) {
57155      prop("resourceType", name);
57156      composePractitionerInner(element);
57157    }
57158  }
57159
57160  protected void composePractitionerInner(Practitioner element) throws IOException {
57161    composeDomainResourceElements(element);
57162    if (element.hasIdentifier()) {
57163      openArray("identifier");
57164      for (Identifier e : element.getIdentifier())
57165        composeIdentifier(null, e);
57166      closeArray();
57167    }
57168    ;
57169    if (element.hasActiveElement()) {
57170      composeBooleanCore("active", element.getActiveElement(), false);
57171      composeBooleanExtras("active", element.getActiveElement(), false);
57172    }
57173    if (element.hasName()) {
57174      openArray("name");
57175      for (HumanName e : element.getName())
57176        composeHumanName(null, e);
57177      closeArray();
57178    }
57179    ;
57180    if (element.hasTelecom()) {
57181      openArray("telecom");
57182      for (ContactPoint e : element.getTelecom())
57183        composeContactPoint(null, e);
57184      closeArray();
57185    }
57186    ;
57187    if (element.hasAddress()) {
57188      openArray("address");
57189      for (Address e : element.getAddress())
57190        composeAddress(null, e);
57191      closeArray();
57192    }
57193    ;
57194    if (element.hasGenderElement()) {
57195      composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
57196          false);
57197      composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
57198          false);
57199    }
57200    if (element.hasBirthDateElement()) {
57201      composeDateCore("birthDate", element.getBirthDateElement(), false);
57202      composeDateExtras("birthDate", element.getBirthDateElement(), false);
57203    }
57204    if (element.hasPhoto()) {
57205      openArray("photo");
57206      for (Attachment e : element.getPhoto())
57207        composeAttachment(null, e);
57208      closeArray();
57209    }
57210    ;
57211    if (element.hasQualification()) {
57212      openArray("qualification");
57213      for (Practitioner.PractitionerQualificationComponent e : element.getQualification())
57214        composePractitionerPractitionerQualificationComponent(null, e);
57215      closeArray();
57216    }
57217    ;
57218    if (element.hasCommunication()) {
57219      openArray("communication");
57220      for (CodeableConcept e : element.getCommunication())
57221        composeCodeableConcept(null, e);
57222      closeArray();
57223    }
57224    ;
57225  }
57226
57227  protected void composePractitionerPractitionerQualificationComponent(String name,
57228      Practitioner.PractitionerQualificationComponent element) throws IOException {
57229    if (element != null) {
57230      open(name);
57231      composePractitionerPractitionerQualificationComponentInner(element);
57232      close();
57233    }
57234  }
57235
57236  protected void composePractitionerPractitionerQualificationComponentInner(
57237      Practitioner.PractitionerQualificationComponent element) throws IOException {
57238    composeBackbone(element);
57239    if (element.hasIdentifier()) {
57240      openArray("identifier");
57241      for (Identifier e : element.getIdentifier())
57242        composeIdentifier(null, e);
57243      closeArray();
57244    }
57245    ;
57246    if (element.hasCode()) {
57247      composeCodeableConcept("code", element.getCode());
57248    }
57249    if (element.hasPeriod()) {
57250      composePeriod("period", element.getPeriod());
57251    }
57252    if (element.hasIssuer()) {
57253      composeReference("issuer", element.getIssuer());
57254    }
57255  }
57256
57257  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
57258    if (element != null) {
57259      prop("resourceType", name);
57260      composePractitionerRoleInner(element);
57261    }
57262  }
57263
57264  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
57265    composeDomainResourceElements(element);
57266    if (element.hasIdentifier()) {
57267      openArray("identifier");
57268      for (Identifier e : element.getIdentifier())
57269        composeIdentifier(null, e);
57270      closeArray();
57271    }
57272    ;
57273    if (element.hasActiveElement()) {
57274      composeBooleanCore("active", element.getActiveElement(), false);
57275      composeBooleanExtras("active", element.getActiveElement(), false);
57276    }
57277    if (element.hasPeriod()) {
57278      composePeriod("period", element.getPeriod());
57279    }
57280    if (element.hasPractitioner()) {
57281      composeReference("practitioner", element.getPractitioner());
57282    }
57283    if (element.hasOrganization()) {
57284      composeReference("organization", element.getOrganization());
57285    }
57286    if (element.hasCode()) {
57287      openArray("code");
57288      for (CodeableConcept e : element.getCode())
57289        composeCodeableConcept(null, e);
57290      closeArray();
57291    }
57292    ;
57293    if (element.hasSpecialty()) {
57294      openArray("specialty");
57295      for (CodeableConcept e : element.getSpecialty())
57296        composeCodeableConcept(null, e);
57297      closeArray();
57298    }
57299    ;
57300    if (element.hasLocation()) {
57301      openArray("location");
57302      for (Reference e : element.getLocation())
57303        composeReference(null, e);
57304      closeArray();
57305    }
57306    ;
57307    if (element.hasHealthcareService()) {
57308      openArray("healthcareService");
57309      for (Reference e : element.getHealthcareService())
57310        composeReference(null, e);
57311      closeArray();
57312    }
57313    ;
57314    if (element.hasTelecom()) {
57315      openArray("telecom");
57316      for (ContactPoint e : element.getTelecom())
57317        composeContactPoint(null, e);
57318      closeArray();
57319    }
57320    ;
57321    if (element.hasAvailableTime()) {
57322      openArray("availableTime");
57323      for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime())
57324        composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
57325      closeArray();
57326    }
57327    ;
57328    if (element.hasNotAvailable()) {
57329      openArray("notAvailable");
57330      for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable())
57331        composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
57332      closeArray();
57333    }
57334    ;
57335    if (element.hasAvailabilityExceptionsElement()) {
57336      composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
57337      composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
57338    }
57339    if (element.hasEndpoint()) {
57340      openArray("endpoint");
57341      for (Reference e : element.getEndpoint())
57342        composeReference(null, e);
57343      closeArray();
57344    }
57345    ;
57346  }
57347
57348  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name,
57349      PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
57350    if (element != null) {
57351      open(name);
57352      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
57353      close();
57354    }
57355  }
57356
57357  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(
57358      PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
57359    composeBackbone(element);
57360    if (element.hasDaysOfWeek()) {
57361      openArray("daysOfWeek");
57362      for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek())
57363        composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
57364      closeArray();
57365      if (anyHasExtras(element.getDaysOfWeek())) {
57366        openArray("_daysOfWeek");
57367        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek())
57368          composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
57369        closeArray();
57370      }
57371    }
57372    ;
57373    if (element.hasAllDayElement()) {
57374      composeBooleanCore("allDay", element.getAllDayElement(), false);
57375      composeBooleanExtras("allDay", element.getAllDayElement(), false);
57376    }
57377    if (element.hasAvailableStartTimeElement()) {
57378      composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
57379      composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
57380    }
57381    if (element.hasAvailableEndTimeElement()) {
57382      composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
57383      composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
57384    }
57385  }
57386
57387  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name,
57388      PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
57389    if (element != null) {
57390      open(name);
57391      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
57392      close();
57393    }
57394  }
57395
57396  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(
57397      PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
57398    composeBackbone(element);
57399    if (element.hasDescriptionElement()) {
57400      composeStringCore("description", element.getDescriptionElement(), false);
57401      composeStringExtras("description", element.getDescriptionElement(), false);
57402    }
57403    if (element.hasDuring()) {
57404      composePeriod("during", element.getDuring());
57405    }
57406  }
57407
57408  protected void composeProcedure(String name, Procedure element) throws IOException {
57409    if (element != null) {
57410      prop("resourceType", name);
57411      composeProcedureInner(element);
57412    }
57413  }
57414
57415  protected void composeProcedureInner(Procedure element) throws IOException {
57416    composeDomainResourceElements(element);
57417    if (element.hasIdentifier()) {
57418      openArray("identifier");
57419      for (Identifier e : element.getIdentifier())
57420        composeIdentifier(null, e);
57421      closeArray();
57422    }
57423    ;
57424    if (element.hasInstantiatesCanonical()) {
57425      openArray("instantiatesCanonical");
57426      for (CanonicalType e : element.getInstantiatesCanonical())
57427        composeCanonicalCore(null, e, true);
57428      closeArray();
57429      if (anyHasExtras(element.getInstantiatesCanonical())) {
57430        openArray("_instantiatesCanonical");
57431        for (CanonicalType e : element.getInstantiatesCanonical())
57432          composeCanonicalExtras(null, e, true);
57433        closeArray();
57434      }
57435    }
57436    ;
57437    if (element.hasInstantiatesUri()) {
57438      openArray("instantiatesUri");
57439      for (UriType e : element.getInstantiatesUri())
57440        composeUriCore(null, e, true);
57441      closeArray();
57442      if (anyHasExtras(element.getInstantiatesUri())) {
57443        openArray("_instantiatesUri");
57444        for (UriType e : element.getInstantiatesUri())
57445          composeUriExtras(null, e, true);
57446        closeArray();
57447      }
57448    }
57449    ;
57450    if (element.hasBasedOn()) {
57451      openArray("basedOn");
57452      for (Reference e : element.getBasedOn())
57453        composeReference(null, e);
57454      closeArray();
57455    }
57456    ;
57457    if (element.hasPartOf()) {
57458      openArray("partOf");
57459      for (Reference e : element.getPartOf())
57460        composeReference(null, e);
57461      closeArray();
57462    }
57463    ;
57464    if (element.hasStatusElement()) {
57465      composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
57466      composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
57467    }
57468    if (element.hasStatusReason()) {
57469      composeCodeableConcept("statusReason", element.getStatusReason());
57470    }
57471    if (element.hasCategory()) {
57472      composeCodeableConcept("category", element.getCategory());
57473    }
57474    if (element.hasCode()) {
57475      composeCodeableConcept("code", element.getCode());
57476    }
57477    if (element.hasSubject()) {
57478      composeReference("subject", element.getSubject());
57479    }
57480    if (element.hasEncounter()) {
57481      composeReference("encounter", element.getEncounter());
57482    }
57483    if (element.hasPerformed()) {
57484      composeType("performed", element.getPerformed());
57485    }
57486    if (element.hasRecorder()) {
57487      composeReference("recorder", element.getRecorder());
57488    }
57489    if (element.hasAsserter()) {
57490      composeReference("asserter", element.getAsserter());
57491    }
57492    if (element.hasPerformer()) {
57493      openArray("performer");
57494      for (Procedure.ProcedurePerformerComponent e : element.getPerformer())
57495        composeProcedureProcedurePerformerComponent(null, e);
57496      closeArray();
57497    }
57498    ;
57499    if (element.hasLocation()) {
57500      composeReference("location", element.getLocation());
57501    }
57502    if (element.hasReasonCode()) {
57503      openArray("reasonCode");
57504      for (CodeableConcept e : element.getReasonCode())
57505        composeCodeableConcept(null, e);
57506      closeArray();
57507    }
57508    ;
57509    if (element.hasReasonReference()) {
57510      openArray("reasonReference");
57511      for (Reference e : element.getReasonReference())
57512        composeReference(null, e);
57513      closeArray();
57514    }
57515    ;
57516    if (element.hasBodySite()) {
57517      openArray("bodySite");
57518      for (CodeableConcept e : element.getBodySite())
57519        composeCodeableConcept(null, e);
57520      closeArray();
57521    }
57522    ;
57523    if (element.hasOutcome()) {
57524      composeCodeableConcept("outcome", element.getOutcome());
57525    }
57526    if (element.hasReport()) {
57527      openArray("report");
57528      for (Reference e : element.getReport())
57529        composeReference(null, e);
57530      closeArray();
57531    }
57532    ;
57533    if (element.hasComplication()) {
57534      openArray("complication");
57535      for (CodeableConcept e : element.getComplication())
57536        composeCodeableConcept(null, e);
57537      closeArray();
57538    }
57539    ;
57540    if (element.hasComplicationDetail()) {
57541      openArray("complicationDetail");
57542      for (Reference e : element.getComplicationDetail())
57543        composeReference(null, e);
57544      closeArray();
57545    }
57546    ;
57547    if (element.hasFollowUp()) {
57548      openArray("followUp");
57549      for (CodeableConcept e : element.getFollowUp())
57550        composeCodeableConcept(null, e);
57551      closeArray();
57552    }
57553    ;
57554    if (element.hasNote()) {
57555      openArray("note");
57556      for (Annotation e : element.getNote())
57557        composeAnnotation(null, e);
57558      closeArray();
57559    }
57560    ;
57561    if (element.hasFocalDevice()) {
57562      openArray("focalDevice");
57563      for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice())
57564        composeProcedureProcedureFocalDeviceComponent(null, e);
57565      closeArray();
57566    }
57567    ;
57568    if (element.hasUsedReference()) {
57569      openArray("usedReference");
57570      for (Reference e : element.getUsedReference())
57571        composeReference(null, e);
57572      closeArray();
57573    }
57574    ;
57575    if (element.hasUsedCode()) {
57576      openArray("usedCode");
57577      for (CodeableConcept e : element.getUsedCode())
57578        composeCodeableConcept(null, e);
57579      closeArray();
57580    }
57581    ;
57582  }
57583
57584  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element)
57585      throws IOException {
57586    if (element != null) {
57587      open(name);
57588      composeProcedureProcedurePerformerComponentInner(element);
57589      close();
57590    }
57591  }
57592
57593  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element)
57594      throws IOException {
57595    composeBackbone(element);
57596    if (element.hasFunction()) {
57597      composeCodeableConcept("function", element.getFunction());
57598    }
57599    if (element.hasActor()) {
57600      composeReference("actor", element.getActor());
57601    }
57602    if (element.hasOnBehalfOf()) {
57603      composeReference("onBehalfOf", element.getOnBehalfOf());
57604    }
57605  }
57606
57607  protected void composeProcedureProcedureFocalDeviceComponent(String name,
57608      Procedure.ProcedureFocalDeviceComponent element) throws IOException {
57609    if (element != null) {
57610      open(name);
57611      composeProcedureProcedureFocalDeviceComponentInner(element);
57612      close();
57613    }
57614  }
57615
57616  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element)
57617      throws IOException {
57618    composeBackbone(element);
57619    if (element.hasAction()) {
57620      composeCodeableConcept("action", element.getAction());
57621    }
57622    if (element.hasManipulated()) {
57623      composeReference("manipulated", element.getManipulated());
57624    }
57625  }
57626
57627  protected void composeProvenance(String name, Provenance element) throws IOException {
57628    if (element != null) {
57629      prop("resourceType", name);
57630      composeProvenanceInner(element);
57631    }
57632  }
57633
57634  protected void composeProvenanceInner(Provenance element) throws IOException {
57635    composeDomainResourceElements(element);
57636    if (element.hasTarget()) {
57637      openArray("target");
57638      for (Reference e : element.getTarget())
57639        composeReference(null, e);
57640      closeArray();
57641    }
57642    ;
57643    if (element.hasOccurred()) {
57644      composeType("occurred", element.getOccurred());
57645    }
57646    if (element.hasRecordedElement()) {
57647      composeInstantCore("recorded", element.getRecordedElement(), false);
57648      composeInstantExtras("recorded", element.getRecordedElement(), false);
57649    }
57650    if (element.hasPolicy()) {
57651      openArray("policy");
57652      for (UriType e : element.getPolicy())
57653        composeUriCore(null, e, true);
57654      closeArray();
57655      if (anyHasExtras(element.getPolicy())) {
57656        openArray("_policy");
57657        for (UriType e : element.getPolicy())
57658          composeUriExtras(null, e, true);
57659        closeArray();
57660      }
57661    }
57662    ;
57663    if (element.hasLocation()) {
57664      composeReference("location", element.getLocation());
57665    }
57666    if (element.hasReason()) {
57667      openArray("reason");
57668      for (CodeableConcept e : element.getReason())
57669        composeCodeableConcept(null, e);
57670      closeArray();
57671    }
57672    ;
57673    if (element.hasActivity()) {
57674      composeCodeableConcept("activity", element.getActivity());
57675    }
57676    if (element.hasAgent()) {
57677      openArray("agent");
57678      for (Provenance.ProvenanceAgentComponent e : element.getAgent())
57679        composeProvenanceProvenanceAgentComponent(null, e);
57680      closeArray();
57681    }
57682    ;
57683    if (element.hasEntity()) {
57684      openArray("entity");
57685      for (Provenance.ProvenanceEntityComponent e : element.getEntity())
57686        composeProvenanceProvenanceEntityComponent(null, e);
57687      closeArray();
57688    }
57689    ;
57690    if (element.hasSignature()) {
57691      openArray("signature");
57692      for (Signature e : element.getSignature())
57693        composeSignature(null, e);
57694      closeArray();
57695    }
57696    ;
57697  }
57698
57699  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element)
57700      throws IOException {
57701    if (element != null) {
57702      open(name);
57703      composeProvenanceProvenanceAgentComponentInner(element);
57704      close();
57705    }
57706  }
57707
57708  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element)
57709      throws IOException {
57710    composeBackbone(element);
57711    if (element.hasType()) {
57712      composeCodeableConcept("type", element.getType());
57713    }
57714    if (element.hasRole()) {
57715      openArray("role");
57716      for (CodeableConcept e : element.getRole())
57717        composeCodeableConcept(null, e);
57718      closeArray();
57719    }
57720    ;
57721    if (element.hasWho()) {
57722      composeReference("who", element.getWho());
57723    }
57724    if (element.hasOnBehalfOf()) {
57725      composeReference("onBehalfOf", element.getOnBehalfOf());
57726    }
57727  }
57728
57729  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element)
57730      throws IOException {
57731    if (element != null) {
57732      open(name);
57733      composeProvenanceProvenanceEntityComponentInner(element);
57734      close();
57735    }
57736  }
57737
57738  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element)
57739      throws IOException {
57740    composeBackbone(element);
57741    if (element.hasRoleElement()) {
57742      composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
57743      composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(),
57744          false);
57745    }
57746    if (element.hasWhat()) {
57747      composeReference("what", element.getWhat());
57748    }
57749    if (element.hasAgent()) {
57750      openArray("agent");
57751      for (Provenance.ProvenanceAgentComponent e : element.getAgent())
57752        composeProvenanceProvenanceAgentComponent(null, e);
57753      closeArray();
57754    }
57755    ;
57756  }
57757
57758  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
57759    if (element != null) {
57760      prop("resourceType", name);
57761      composeQuestionnaireInner(element);
57762    }
57763  }
57764
57765  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
57766    composeDomainResourceElements(element);
57767    if (element.hasUrlElement()) {
57768      composeUriCore("url", element.getUrlElement(), false);
57769      composeUriExtras("url", element.getUrlElement(), false);
57770    }
57771    if (element.hasIdentifier()) {
57772      openArray("identifier");
57773      for (Identifier e : element.getIdentifier())
57774        composeIdentifier(null, e);
57775      closeArray();
57776    }
57777    ;
57778    if (element.hasVersionElement()) {
57779      composeStringCore("version", element.getVersionElement(), false);
57780      composeStringExtras("version", element.getVersionElement(), false);
57781    }
57782    if (element.hasNameElement()) {
57783      composeStringCore("name", element.getNameElement(), false);
57784      composeStringExtras("name", element.getNameElement(), false);
57785    }
57786    if (element.hasTitleElement()) {
57787      composeStringCore("title", element.getTitleElement(), false);
57788      composeStringExtras("title", element.getTitleElement(), false);
57789    }
57790    if (element.hasDerivedFrom()) {
57791      openArray("derivedFrom");
57792      for (CanonicalType e : element.getDerivedFrom())
57793        composeCanonicalCore(null, e, true);
57794      closeArray();
57795      if (anyHasExtras(element.getDerivedFrom())) {
57796        openArray("_derivedFrom");
57797        for (CanonicalType e : element.getDerivedFrom())
57798          composeCanonicalExtras(null, e, true);
57799        closeArray();
57800      }
57801    }
57802    ;
57803    if (element.hasStatusElement()) {
57804      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
57805          false);
57806      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
57807          false);
57808    }
57809    if (element.hasExperimentalElement()) {
57810      composeBooleanCore("experimental", element.getExperimentalElement(), false);
57811      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57812    }
57813    if (element.hasSubjectType()) {
57814      openArray("subjectType");
57815      for (CodeType e : element.getSubjectType())
57816        composeCodeCore(null, e, true);
57817      closeArray();
57818      if (anyHasExtras(element.getSubjectType())) {
57819        openArray("_subjectType");
57820        for (CodeType e : element.getSubjectType())
57821          composeCodeExtras(null, e, true);
57822        closeArray();
57823      }
57824    }
57825    ;
57826    if (element.hasDateElement()) {
57827      composeDateTimeCore("date", element.getDateElement(), false);
57828      composeDateTimeExtras("date", element.getDateElement(), false);
57829    }
57830    if (element.hasPublisherElement()) {
57831      composeStringCore("publisher", element.getPublisherElement(), false);
57832      composeStringExtras("publisher", element.getPublisherElement(), false);
57833    }
57834    if (element.hasContact()) {
57835      openArray("contact");
57836      for (ContactDetail e : element.getContact())
57837        composeContactDetail(null, e);
57838      closeArray();
57839    }
57840    ;
57841    if (element.hasDescriptionElement()) {
57842      composeMarkdownCore("description", element.getDescriptionElement(), false);
57843      composeMarkdownExtras("description", element.getDescriptionElement(), false);
57844    }
57845    if (element.hasUseContext()) {
57846      openArray("useContext");
57847      for (UsageContext e : element.getUseContext())
57848        composeUsageContext(null, e);
57849      closeArray();
57850    }
57851    ;
57852    if (element.hasJurisdiction()) {
57853      openArray("jurisdiction");
57854      for (CodeableConcept e : element.getJurisdiction())
57855        composeCodeableConcept(null, e);
57856      closeArray();
57857    }
57858    ;
57859    if (element.hasPurposeElement()) {
57860      composeMarkdownCore("purpose", element.getPurposeElement(), false);
57861      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57862    }
57863    if (element.hasCopyrightElement()) {
57864      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57865      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57866    }
57867    if (element.hasApprovalDateElement()) {
57868      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
57869      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
57870    }
57871    if (element.hasLastReviewDateElement()) {
57872      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
57873      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
57874    }
57875    if (element.hasEffectivePeriod()) {
57876      composePeriod("effectivePeriod", element.getEffectivePeriod());
57877    }
57878    if (element.hasCode()) {
57879      openArray("code");
57880      for (Coding e : element.getCode())
57881        composeCoding(null, e);
57882      closeArray();
57883    }
57884    ;
57885    if (element.hasItem()) {
57886      openArray("item");
57887      for (Questionnaire.QuestionnaireItemComponent e : element.getItem())
57888        composeQuestionnaireQuestionnaireItemComponent(null, e);
57889      closeArray();
57890    }
57891    ;
57892  }
57893
57894  protected void composeQuestionnaireQuestionnaireItemComponent(String name,
57895      Questionnaire.QuestionnaireItemComponent element) throws IOException {
57896    if (element != null) {
57897      open(name);
57898      composeQuestionnaireQuestionnaireItemComponentInner(element);
57899      close();
57900    }
57901  }
57902
57903  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element)
57904      throws IOException {
57905    composeBackbone(element);
57906    if (element.hasLinkIdElement()) {
57907      composeStringCore("linkId", element.getLinkIdElement(), false);
57908      composeStringExtras("linkId", element.getLinkIdElement(), false);
57909    }
57910    if (element.hasDefinitionElement()) {
57911      composeUriCore("definition", element.getDefinitionElement(), false);
57912      composeUriExtras("definition", element.getDefinitionElement(), false);
57913    }
57914    if (element.hasCode()) {
57915      openArray("code");
57916      for (Coding e : element.getCode())
57917        composeCoding(null, e);
57918      closeArray();
57919    }
57920    ;
57921    if (element.hasPrefixElement()) {
57922      composeStringCore("prefix", element.getPrefixElement(), false);
57923      composeStringExtras("prefix", element.getPrefixElement(), false);
57924    }
57925    if (element.hasTextElement()) {
57926      composeStringCore("text", element.getTextElement(), false);
57927      composeStringExtras("text", element.getTextElement(), false);
57928    }
57929    if (element.hasTypeElement()) {
57930      composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(),
57931          false);
57932      composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(),
57933          false);
57934    }
57935    if (element.hasEnableWhen()) {
57936      openArray("enableWhen");
57937      for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen())
57938        composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
57939      closeArray();
57940    }
57941    ;
57942    if (element.hasEnableBehaviorElement()) {
57943      composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(),
57944          new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
57945      composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(),
57946          new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
57947    }
57948    if (element.hasRequiredElement()) {
57949      composeBooleanCore("required", element.getRequiredElement(), false);
57950      composeBooleanExtras("required", element.getRequiredElement(), false);
57951    }
57952    if (element.hasRepeatsElement()) {
57953      composeBooleanCore("repeats", element.getRepeatsElement(), false);
57954      composeBooleanExtras("repeats", element.getRepeatsElement(), false);
57955    }
57956    if (element.hasReadOnlyElement()) {
57957      composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
57958      composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
57959    }
57960    if (element.hasMaxLengthElement()) {
57961      composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
57962      composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
57963    }
57964    if (element.hasAnswerValueSetElement()) {
57965      composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
57966      composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
57967    }
57968    if (element.hasAnswerOption()) {
57969      openArray("answerOption");
57970      for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption())
57971        composeQuestionnaireQuestionnaireItemAnswerOptionComponent(null, e);
57972      closeArray();
57973    }
57974    ;
57975    if (element.hasInitial()) {
57976      openArray("initial");
57977      for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial())
57978        composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
57979      closeArray();
57980    }
57981    ;
57982    if (element.hasItem()) {
57983      openArray("item");
57984      for (Questionnaire.QuestionnaireItemComponent e : element.getItem())
57985        composeQuestionnaireQuestionnaireItemComponent(null, e);
57986      closeArray();
57987    }
57988    ;
57989  }
57990
57991  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name,
57992      Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
57993    if (element != null) {
57994      open(name);
57995      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
57996      close();
57997    }
57998  }
57999
58000  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(
58001      Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
58002    composeBackbone(element);
58003    if (element.hasQuestionElement()) {
58004      composeStringCore("question", element.getQuestionElement(), false);
58005      composeStringExtras("question", element.getQuestionElement(), false);
58006    }
58007    if (element.hasOperatorElement()) {
58008      composeEnumerationCore("operator", element.getOperatorElement(),
58009          new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
58010      composeEnumerationExtras("operator", element.getOperatorElement(),
58011          new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
58012    }
58013    if (element.hasAnswer()) {
58014      composeType("answer", element.getAnswer());
58015    }
58016  }
58017
58018  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name,
58019      Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
58020    if (element != null) {
58021      open(name);
58022      composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(element);
58023      close();
58024    }
58025  }
58026
58027  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(
58028      Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
58029    composeBackbone(element);
58030    if (element.hasValue()) {
58031      composeType("value", element.getValue());
58032    }
58033    if (element.hasInitialSelectedElement()) {
58034      composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
58035      composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
58036    }
58037  }
58038
58039  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name,
58040      Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
58041    if (element != null) {
58042      open(name);
58043      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
58044      close();
58045    }
58046  }
58047
58048  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(
58049      Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
58050    composeBackbone(element);
58051    if (element.hasValue()) {
58052      composeType("value", element.getValue());
58053    }
58054  }
58055
58056  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
58057    if (element != null) {
58058      prop("resourceType", name);
58059      composeQuestionnaireResponseInner(element);
58060    }
58061  }
58062
58063  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
58064    composeDomainResourceElements(element);
58065    if (element.hasIdentifier()) {
58066      composeIdentifier("identifier", element.getIdentifier());
58067    }
58068    if (element.hasBasedOn()) {
58069      openArray("basedOn");
58070      for (Reference e : element.getBasedOn())
58071        composeReference(null, e);
58072      closeArray();
58073    }
58074    ;
58075    if (element.hasPartOf()) {
58076      openArray("partOf");
58077      for (Reference e : element.getPartOf())
58078        composeReference(null, e);
58079      closeArray();
58080    }
58081    ;
58082    if (element.hasQuestionnaireElement()) {
58083      composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
58084      composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
58085    }
58086    if (element.hasStatusElement()) {
58087      composeEnumerationCore("status", element.getStatusElement(),
58088          new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
58089      composeEnumerationExtras("status", element.getStatusElement(),
58090          new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
58091    }
58092    if (element.hasSubject()) {
58093      composeReference("subject", element.getSubject());
58094    }
58095    if (element.hasEncounter()) {
58096      composeReference("encounter", element.getEncounter());
58097    }
58098    if (element.hasAuthoredElement()) {
58099      composeDateTimeCore("authored", element.getAuthoredElement(), false);
58100      composeDateTimeExtras("authored", element.getAuthoredElement(), false);
58101    }
58102    if (element.hasAuthor()) {
58103      composeReference("author", element.getAuthor());
58104    }
58105    if (element.hasSource()) {
58106      composeReference("source", element.getSource());
58107    }
58108    if (element.hasItem()) {
58109      openArray("item");
58110      for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem())
58111        composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
58112      closeArray();
58113    }
58114    ;
58115  }
58116
58117  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name,
58118      QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
58119    if (element != null) {
58120      open(name);
58121      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
58122      close();
58123    }
58124  }
58125
58126  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(
58127      QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
58128    composeBackbone(element);
58129    if (element.hasLinkIdElement()) {
58130      composeStringCore("linkId", element.getLinkIdElement(), false);
58131      composeStringExtras("linkId", element.getLinkIdElement(), false);
58132    }
58133    if (element.hasDefinitionElement()) {
58134      composeUriCore("definition", element.getDefinitionElement(), false);
58135      composeUriExtras("definition", element.getDefinitionElement(), false);
58136    }
58137    if (element.hasTextElement()) {
58138      composeStringCore("text", element.getTextElement(), false);
58139      composeStringExtras("text", element.getTextElement(), false);
58140    }
58141    if (element.hasAnswer()) {
58142      openArray("answer");
58143      for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer())
58144        composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
58145      closeArray();
58146    }
58147    ;
58148    if (element.hasItem()) {
58149      openArray("item");
58150      for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem())
58151        composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
58152      closeArray();
58153    }
58154    ;
58155  }
58156
58157  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name,
58158      QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
58159    if (element != null) {
58160      open(name);
58161      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
58162      close();
58163    }
58164  }
58165
58166  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(
58167      QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
58168    composeBackbone(element);
58169    if (element.hasValue()) {
58170      composeType("value", element.getValue());
58171    }
58172    if (element.hasItem()) {
58173      openArray("item");
58174      for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem())
58175        composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
58176      closeArray();
58177    }
58178    ;
58179  }
58180
58181  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
58182    if (element != null) {
58183      prop("resourceType", name);
58184      composeRelatedPersonInner(element);
58185    }
58186  }
58187
58188  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
58189    composeDomainResourceElements(element);
58190    if (element.hasIdentifier()) {
58191      openArray("identifier");
58192      for (Identifier e : element.getIdentifier())
58193        composeIdentifier(null, e);
58194      closeArray();
58195    }
58196    ;
58197    if (element.hasActiveElement()) {
58198      composeBooleanCore("active", element.getActiveElement(), false);
58199      composeBooleanExtras("active", element.getActiveElement(), false);
58200    }
58201    if (element.hasPatient()) {
58202      composeReference("patient", element.getPatient());
58203    }
58204    if (element.hasRelationship()) {
58205      openArray("relationship");
58206      for (CodeableConcept e : element.getRelationship())
58207        composeCodeableConcept(null, e);
58208      closeArray();
58209    }
58210    ;
58211    if (element.hasName()) {
58212      openArray("name");
58213      for (HumanName e : element.getName())
58214        composeHumanName(null, e);
58215      closeArray();
58216    }
58217    ;
58218    if (element.hasTelecom()) {
58219      openArray("telecom");
58220      for (ContactPoint e : element.getTelecom())
58221        composeContactPoint(null, e);
58222      closeArray();
58223    }
58224    ;
58225    if (element.hasGenderElement()) {
58226      composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
58227          false);
58228      composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(),
58229          false);
58230    }
58231    if (element.hasBirthDateElement()) {
58232      composeDateCore("birthDate", element.getBirthDateElement(), false);
58233      composeDateExtras("birthDate", element.getBirthDateElement(), false);
58234    }
58235    if (element.hasAddress()) {
58236      openArray("address");
58237      for (Address e : element.getAddress())
58238        composeAddress(null, e);
58239      closeArray();
58240    }
58241    ;
58242    if (element.hasPhoto()) {
58243      openArray("photo");
58244      for (Attachment e : element.getPhoto())
58245        composeAttachment(null, e);
58246      closeArray();
58247    }
58248    ;
58249    if (element.hasPeriod()) {
58250      composePeriod("period", element.getPeriod());
58251    }
58252    if (element.hasCommunication()) {
58253      openArray("communication");
58254      for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication())
58255        composeRelatedPersonRelatedPersonCommunicationComponent(null, e);
58256      closeArray();
58257    }
58258    ;
58259  }
58260
58261  protected void composeRelatedPersonRelatedPersonCommunicationComponent(String name,
58262      RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
58263    if (element != null) {
58264      open(name);
58265      composeRelatedPersonRelatedPersonCommunicationComponentInner(element);
58266      close();
58267    }
58268  }
58269
58270  protected void composeRelatedPersonRelatedPersonCommunicationComponentInner(
58271      RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
58272    composeBackbone(element);
58273    if (element.hasLanguage()) {
58274      composeCodeableConcept("language", element.getLanguage());
58275    }
58276    if (element.hasPreferredElement()) {
58277      composeBooleanCore("preferred", element.getPreferredElement(), false);
58278      composeBooleanExtras("preferred", element.getPreferredElement(), false);
58279    }
58280  }
58281
58282  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
58283    if (element != null) {
58284      prop("resourceType", name);
58285      composeRequestGroupInner(element);
58286    }
58287  }
58288
58289  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
58290    composeDomainResourceElements(element);
58291    if (element.hasIdentifier()) {
58292      openArray("identifier");
58293      for (Identifier e : element.getIdentifier())
58294        composeIdentifier(null, e);
58295      closeArray();
58296    }
58297    ;
58298    if (element.hasInstantiatesCanonical()) {
58299      openArray("instantiatesCanonical");
58300      for (CanonicalType e : element.getInstantiatesCanonical())
58301        composeCanonicalCore(null, e, true);
58302      closeArray();
58303      if (anyHasExtras(element.getInstantiatesCanonical())) {
58304        openArray("_instantiatesCanonical");
58305        for (CanonicalType e : element.getInstantiatesCanonical())
58306          composeCanonicalExtras(null, e, true);
58307        closeArray();
58308      }
58309    }
58310    ;
58311    if (element.hasInstantiatesUri()) {
58312      openArray("instantiatesUri");
58313      for (UriType e : element.getInstantiatesUri())
58314        composeUriCore(null, e, true);
58315      closeArray();
58316      if (anyHasExtras(element.getInstantiatesUri())) {
58317        openArray("_instantiatesUri");
58318        for (UriType e : element.getInstantiatesUri())
58319          composeUriExtras(null, e, true);
58320        closeArray();
58321      }
58322    }
58323    ;
58324    if (element.hasBasedOn()) {
58325      openArray("basedOn");
58326      for (Reference e : element.getBasedOn())
58327        composeReference(null, e);
58328      closeArray();
58329    }
58330    ;
58331    if (element.hasReplaces()) {
58332      openArray("replaces");
58333      for (Reference e : element.getReplaces())
58334        composeReference(null, e);
58335      closeArray();
58336    }
58337    ;
58338    if (element.hasGroupIdentifier()) {
58339      composeIdentifier("groupIdentifier", element.getGroupIdentifier());
58340    }
58341    if (element.hasStatusElement()) {
58342      composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
58343      composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(),
58344          false);
58345    }
58346    if (element.hasIntentElement()) {
58347      composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
58348      composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(),
58349          false);
58350    }
58351    if (element.hasPriorityElement()) {
58352      composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(),
58353          false);
58354      composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(),
58355          false);
58356    }
58357    if (element.hasCode()) {
58358      composeCodeableConcept("code", element.getCode());
58359    }
58360    if (element.hasSubject()) {
58361      composeReference("subject", element.getSubject());
58362    }
58363    if (element.hasEncounter()) {
58364      composeReference("encounter", element.getEncounter());
58365    }
58366    if (element.hasAuthoredOnElement()) {
58367      composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
58368      composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
58369    }
58370    if (element.hasAuthor()) {
58371      composeReference("author", element.getAuthor());
58372    }
58373    if (element.hasReasonCode()) {
58374      openArray("reasonCode");
58375      for (CodeableConcept e : element.getReasonCode())
58376        composeCodeableConcept(null, e);
58377      closeArray();
58378    }
58379    ;
58380    if (element.hasReasonReference()) {
58381      openArray("reasonReference");
58382      for (Reference e : element.getReasonReference())
58383        composeReference(null, e);
58384      closeArray();
58385    }
58386    ;
58387    if (element.hasNote()) {
58388      openArray("note");
58389      for (Annotation e : element.getNote())
58390        composeAnnotation(null, e);
58391      closeArray();
58392    }
58393    ;
58394    if (element.hasAction()) {
58395      openArray("action");
58396      for (RequestGroup.RequestGroupActionComponent e : element.getAction())
58397        composeRequestGroupRequestGroupActionComponent(null, e);
58398      closeArray();
58399    }
58400    ;
58401  }
58402
58403  protected void composeRequestGroupRequestGroupActionComponent(String name,
58404      RequestGroup.RequestGroupActionComponent element) throws IOException {
58405    if (element != null) {
58406      open(name);
58407      composeRequestGroupRequestGroupActionComponentInner(element);
58408      close();
58409    }
58410  }
58411
58412  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element)
58413      throws IOException {
58414    composeBackbone(element);
58415    if (element.hasPrefixElement()) {
58416      composeStringCore("prefix", element.getPrefixElement(), false);
58417      composeStringExtras("prefix", element.getPrefixElement(), false);
58418    }
58419    if (element.hasTitleElement()) {
58420      composeStringCore("title", element.getTitleElement(), false);
58421      composeStringExtras("title", element.getTitleElement(), false);
58422    }
58423    if (element.hasDescriptionElement()) {
58424      composeStringCore("description", element.getDescriptionElement(), false);
58425      composeStringExtras("description", element.getDescriptionElement(), false);
58426    }
58427    if (element.hasTextEquivalentElement()) {
58428      composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
58429      composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
58430    }
58431    if (element.hasPriorityElement()) {
58432      composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(),
58433          false);
58434      composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(),
58435          false);
58436    }
58437    if (element.hasCode()) {
58438      openArray("code");
58439      for (CodeableConcept e : element.getCode())
58440        composeCodeableConcept(null, e);
58441      closeArray();
58442    }
58443    ;
58444    if (element.hasDocumentation()) {
58445      openArray("documentation");
58446      for (RelatedArtifact e : element.getDocumentation())
58447        composeRelatedArtifact(null, e);
58448      closeArray();
58449    }
58450    ;
58451    if (element.hasCondition()) {
58452      openArray("condition");
58453      for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition())
58454        composeRequestGroupRequestGroupActionConditionComponent(null, e);
58455      closeArray();
58456    }
58457    ;
58458    if (element.hasRelatedAction()) {
58459      openArray("relatedAction");
58460      for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction())
58461        composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
58462      closeArray();
58463    }
58464    ;
58465    if (element.hasTiming()) {
58466      composeType("timing", element.getTiming());
58467    }
58468    if (element.hasParticipant()) {
58469      openArray("participant");
58470      for (Reference e : element.getParticipant())
58471        composeReference(null, e);
58472      closeArray();
58473    }
58474    ;
58475    if (element.hasType()) {
58476      composeCodeableConcept("type", element.getType());
58477    }
58478    if (element.hasGroupingBehaviorElement()) {
58479      composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(),
58480          new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
58481      composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(),
58482          new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
58483    }
58484    if (element.hasSelectionBehaviorElement()) {
58485      composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(),
58486          new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
58487      composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(),
58488          new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
58489    }
58490    if (element.hasRequiredBehaviorElement()) {
58491      composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(),
58492          new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
58493      composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(),
58494          new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
58495    }
58496    if (element.hasPrecheckBehaviorElement()) {
58497      composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(),
58498          new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
58499      composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(),
58500          new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
58501    }
58502    if (element.hasCardinalityBehaviorElement()) {
58503      composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(),
58504          new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
58505      composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(),
58506          new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
58507    }
58508    if (element.hasResource()) {
58509      composeReference("resource", element.getResource());
58510    }
58511    if (element.hasAction()) {
58512      openArray("action");
58513      for (RequestGroup.RequestGroupActionComponent e : element.getAction())
58514        composeRequestGroupRequestGroupActionComponent(null, e);
58515      closeArray();
58516    }
58517    ;
58518  }
58519
58520  protected void composeRequestGroupRequestGroupActionConditionComponent(String name,
58521      RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
58522    if (element != null) {
58523      open(name);
58524      composeRequestGroupRequestGroupActionConditionComponentInner(element);
58525      close();
58526    }
58527  }
58528
58529  protected void composeRequestGroupRequestGroupActionConditionComponentInner(
58530      RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
58531    composeBackbone(element);
58532    if (element.hasKindElement()) {
58533      composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(),
58534          false);
58535      composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(),
58536          false);
58537    }
58538    if (element.hasExpression()) {
58539      composeExpression("expression", element.getExpression());
58540    }
58541  }
58542
58543  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name,
58544      RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
58545    if (element != null) {
58546      open(name);
58547      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
58548      close();
58549    }
58550  }
58551
58552  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(
58553      RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
58554    composeBackbone(element);
58555    if (element.hasActionIdElement()) {
58556      composeIdCore("actionId", element.getActionIdElement(), false);
58557      composeIdExtras("actionId", element.getActionIdElement(), false);
58558    }
58559    if (element.hasRelationshipElement()) {
58560      composeEnumerationCore("relationship", element.getRelationshipElement(),
58561          new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
58562      composeEnumerationExtras("relationship", element.getRelationshipElement(),
58563          new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
58564    }
58565    if (element.hasOffset()) {
58566      composeType("offset", element.getOffset());
58567    }
58568  }
58569
58570  protected void composeResearchDefinition(String name, ResearchDefinition element) throws IOException {
58571    if (element != null) {
58572      prop("resourceType", name);
58573      composeResearchDefinitionInner(element);
58574    }
58575  }
58576
58577  protected void composeResearchDefinitionInner(ResearchDefinition element) throws IOException {
58578    composeDomainResourceElements(element);
58579    if (element.hasUrlElement()) {
58580      composeUriCore("url", element.getUrlElement(), false);
58581      composeUriExtras("url", element.getUrlElement(), false);
58582    }
58583    if (element.hasIdentifier()) {
58584      openArray("identifier");
58585      for (Identifier e : element.getIdentifier())
58586        composeIdentifier(null, e);
58587      closeArray();
58588    }
58589    ;
58590    if (element.hasVersionElement()) {
58591      composeStringCore("version", element.getVersionElement(), false);
58592      composeStringExtras("version", element.getVersionElement(), false);
58593    }
58594    if (element.hasNameElement()) {
58595      composeStringCore("name", element.getNameElement(), false);
58596      composeStringExtras("name", element.getNameElement(), false);
58597    }
58598    if (element.hasTitleElement()) {
58599      composeStringCore("title", element.getTitleElement(), false);
58600      composeStringExtras("title", element.getTitleElement(), false);
58601    }
58602    if (element.hasShortTitleElement()) {
58603      composeStringCore("shortTitle", element.getShortTitleElement(), false);
58604      composeStringExtras("shortTitle", element.getShortTitleElement(), false);
58605    }
58606    if (element.hasSubtitleElement()) {
58607      composeStringCore("subtitle", element.getSubtitleElement(), false);
58608      composeStringExtras("subtitle", element.getSubtitleElement(), false);
58609    }
58610    if (element.hasStatusElement()) {
58611      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
58612          false);
58613      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
58614          false);
58615    }
58616    if (element.hasExperimentalElement()) {
58617      composeBooleanCore("experimental", element.getExperimentalElement(), false);
58618      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58619    }
58620    if (element.hasSubject()) {
58621      composeType("subject", element.getSubject());
58622    }
58623    if (element.hasDateElement()) {
58624      composeDateTimeCore("date", element.getDateElement(), false);
58625      composeDateTimeExtras("date", element.getDateElement(), false);
58626    }
58627    if (element.hasPublisherElement()) {
58628      composeStringCore("publisher", element.getPublisherElement(), false);
58629      composeStringExtras("publisher", element.getPublisherElement(), false);
58630    }
58631    if (element.hasContact()) {
58632      openArray("contact");
58633      for (ContactDetail e : element.getContact())
58634        composeContactDetail(null, e);
58635      closeArray();
58636    }
58637    ;
58638    if (element.hasDescriptionElement()) {
58639      composeMarkdownCore("description", element.getDescriptionElement(), false);
58640      composeMarkdownExtras("description", element.getDescriptionElement(), false);
58641    }
58642    if (element.hasComment()) {
58643      openArray("comment");
58644      for (StringType e : element.getComment())
58645        composeStringCore(null, e, true);
58646      closeArray();
58647      if (anyHasExtras(element.getComment())) {
58648        openArray("_comment");
58649        for (StringType e : element.getComment())
58650          composeStringExtras(null, e, true);
58651        closeArray();
58652      }
58653    }
58654    ;
58655    if (element.hasUseContext()) {
58656      openArray("useContext");
58657      for (UsageContext e : element.getUseContext())
58658        composeUsageContext(null, e);
58659      closeArray();
58660    }
58661    ;
58662    if (element.hasJurisdiction()) {
58663      openArray("jurisdiction");
58664      for (CodeableConcept e : element.getJurisdiction())
58665        composeCodeableConcept(null, e);
58666      closeArray();
58667    }
58668    ;
58669    if (element.hasPurposeElement()) {
58670      composeMarkdownCore("purpose", element.getPurposeElement(), false);
58671      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58672    }
58673    if (element.hasUsageElement()) {
58674      composeStringCore("usage", element.getUsageElement(), false);
58675      composeStringExtras("usage", element.getUsageElement(), false);
58676    }
58677    if (element.hasCopyrightElement()) {
58678      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58679      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58680    }
58681    if (element.hasApprovalDateElement()) {
58682      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
58683      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
58684    }
58685    if (element.hasLastReviewDateElement()) {
58686      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
58687      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
58688    }
58689    if (element.hasEffectivePeriod()) {
58690      composePeriod("effectivePeriod", element.getEffectivePeriod());
58691    }
58692    if (element.hasTopic()) {
58693      openArray("topic");
58694      for (CodeableConcept e : element.getTopic())
58695        composeCodeableConcept(null, e);
58696      closeArray();
58697    }
58698    ;
58699    if (element.hasAuthor()) {
58700      openArray("author");
58701      for (ContactDetail e : element.getAuthor())
58702        composeContactDetail(null, e);
58703      closeArray();
58704    }
58705    ;
58706    if (element.hasEditor()) {
58707      openArray("editor");
58708      for (ContactDetail e : element.getEditor())
58709        composeContactDetail(null, e);
58710      closeArray();
58711    }
58712    ;
58713    if (element.hasReviewer()) {
58714      openArray("reviewer");
58715      for (ContactDetail e : element.getReviewer())
58716        composeContactDetail(null, e);
58717      closeArray();
58718    }
58719    ;
58720    if (element.hasEndorser()) {
58721      openArray("endorser");
58722      for (ContactDetail e : element.getEndorser())
58723        composeContactDetail(null, e);
58724      closeArray();
58725    }
58726    ;
58727    if (element.hasRelatedArtifact()) {
58728      openArray("relatedArtifact");
58729      for (RelatedArtifact e : element.getRelatedArtifact())
58730        composeRelatedArtifact(null, e);
58731      closeArray();
58732    }
58733    ;
58734    if (element.hasLibrary()) {
58735      openArray("library");
58736      for (CanonicalType e : element.getLibrary())
58737        composeCanonicalCore(null, e, true);
58738      closeArray();
58739      if (anyHasExtras(element.getLibrary())) {
58740        openArray("_library");
58741        for (CanonicalType e : element.getLibrary())
58742          composeCanonicalExtras(null, e, true);
58743        closeArray();
58744      }
58745    }
58746    ;
58747    if (element.hasPopulation()) {
58748      composeReference("population", element.getPopulation());
58749    }
58750    if (element.hasExposure()) {
58751      composeReference("exposure", element.getExposure());
58752    }
58753    if (element.hasExposureAlternative()) {
58754      composeReference("exposureAlternative", element.getExposureAlternative());
58755    }
58756    if (element.hasOutcome()) {
58757      composeReference("outcome", element.getOutcome());
58758    }
58759  }
58760
58761  protected void composeResearchElementDefinition(String name, ResearchElementDefinition element) throws IOException {
58762    if (element != null) {
58763      prop("resourceType", name);
58764      composeResearchElementDefinitionInner(element);
58765    }
58766  }
58767
58768  protected void composeResearchElementDefinitionInner(ResearchElementDefinition element) throws IOException {
58769    composeDomainResourceElements(element);
58770    if (element.hasUrlElement()) {
58771      composeUriCore("url", element.getUrlElement(), false);
58772      composeUriExtras("url", element.getUrlElement(), false);
58773    }
58774    if (element.hasIdentifier()) {
58775      openArray("identifier");
58776      for (Identifier e : element.getIdentifier())
58777        composeIdentifier(null, e);
58778      closeArray();
58779    }
58780    ;
58781    if (element.hasVersionElement()) {
58782      composeStringCore("version", element.getVersionElement(), false);
58783      composeStringExtras("version", element.getVersionElement(), false);
58784    }
58785    if (element.hasNameElement()) {
58786      composeStringCore("name", element.getNameElement(), false);
58787      composeStringExtras("name", element.getNameElement(), false);
58788    }
58789    if (element.hasTitleElement()) {
58790      composeStringCore("title", element.getTitleElement(), false);
58791      composeStringExtras("title", element.getTitleElement(), false);
58792    }
58793    if (element.hasShortTitleElement()) {
58794      composeStringCore("shortTitle", element.getShortTitleElement(), false);
58795      composeStringExtras("shortTitle", element.getShortTitleElement(), false);
58796    }
58797    if (element.hasSubtitleElement()) {
58798      composeStringCore("subtitle", element.getSubtitleElement(), false);
58799      composeStringExtras("subtitle", element.getSubtitleElement(), false);
58800    }
58801    if (element.hasStatusElement()) {
58802      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
58803          false);
58804      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
58805          false);
58806    }
58807    if (element.hasExperimentalElement()) {
58808      composeBooleanCore("experimental", element.getExperimentalElement(), false);
58809      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58810    }
58811    if (element.hasSubject()) {
58812      composeType("subject", element.getSubject());
58813    }
58814    if (element.hasDateElement()) {
58815      composeDateTimeCore("date", element.getDateElement(), false);
58816      composeDateTimeExtras("date", element.getDateElement(), false);
58817    }
58818    if (element.hasPublisherElement()) {
58819      composeStringCore("publisher", element.getPublisherElement(), false);
58820      composeStringExtras("publisher", element.getPublisherElement(), false);
58821    }
58822    if (element.hasContact()) {
58823      openArray("contact");
58824      for (ContactDetail e : element.getContact())
58825        composeContactDetail(null, e);
58826      closeArray();
58827    }
58828    ;
58829    if (element.hasDescriptionElement()) {
58830      composeMarkdownCore("description", element.getDescriptionElement(), false);
58831      composeMarkdownExtras("description", element.getDescriptionElement(), false);
58832    }
58833    if (element.hasComment()) {
58834      openArray("comment");
58835      for (StringType e : element.getComment())
58836        composeStringCore(null, e, true);
58837      closeArray();
58838      if (anyHasExtras(element.getComment())) {
58839        openArray("_comment");
58840        for (StringType e : element.getComment())
58841          composeStringExtras(null, e, true);
58842        closeArray();
58843      }
58844    }
58845    ;
58846    if (element.hasUseContext()) {
58847      openArray("useContext");
58848      for (UsageContext e : element.getUseContext())
58849        composeUsageContext(null, e);
58850      closeArray();
58851    }
58852    ;
58853    if (element.hasJurisdiction()) {
58854      openArray("jurisdiction");
58855      for (CodeableConcept e : element.getJurisdiction())
58856        composeCodeableConcept(null, e);
58857      closeArray();
58858    }
58859    ;
58860    if (element.hasPurposeElement()) {
58861      composeMarkdownCore("purpose", element.getPurposeElement(), false);
58862      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58863    }
58864    if (element.hasUsageElement()) {
58865      composeStringCore("usage", element.getUsageElement(), false);
58866      composeStringExtras("usage", element.getUsageElement(), false);
58867    }
58868    if (element.hasCopyrightElement()) {
58869      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58870      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58871    }
58872    if (element.hasApprovalDateElement()) {
58873      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
58874      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
58875    }
58876    if (element.hasLastReviewDateElement()) {
58877      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
58878      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
58879    }
58880    if (element.hasEffectivePeriod()) {
58881      composePeriod("effectivePeriod", element.getEffectivePeriod());
58882    }
58883    if (element.hasTopic()) {
58884      openArray("topic");
58885      for (CodeableConcept e : element.getTopic())
58886        composeCodeableConcept(null, e);
58887      closeArray();
58888    }
58889    ;
58890    if (element.hasAuthor()) {
58891      openArray("author");
58892      for (ContactDetail e : element.getAuthor())
58893        composeContactDetail(null, e);
58894      closeArray();
58895    }
58896    ;
58897    if (element.hasEditor()) {
58898      openArray("editor");
58899      for (ContactDetail e : element.getEditor())
58900        composeContactDetail(null, e);
58901      closeArray();
58902    }
58903    ;
58904    if (element.hasReviewer()) {
58905      openArray("reviewer");
58906      for (ContactDetail e : element.getReviewer())
58907        composeContactDetail(null, e);
58908      closeArray();
58909    }
58910    ;
58911    if (element.hasEndorser()) {
58912      openArray("endorser");
58913      for (ContactDetail e : element.getEndorser())
58914        composeContactDetail(null, e);
58915      closeArray();
58916    }
58917    ;
58918    if (element.hasRelatedArtifact()) {
58919      openArray("relatedArtifact");
58920      for (RelatedArtifact e : element.getRelatedArtifact())
58921        composeRelatedArtifact(null, e);
58922      closeArray();
58923    }
58924    ;
58925    if (element.hasLibrary()) {
58926      openArray("library");
58927      for (CanonicalType e : element.getLibrary())
58928        composeCanonicalCore(null, e, true);
58929      closeArray();
58930      if (anyHasExtras(element.getLibrary())) {
58931        openArray("_library");
58932        for (CanonicalType e : element.getLibrary())
58933          composeCanonicalExtras(null, e, true);
58934        closeArray();
58935      }
58936    }
58937    ;
58938    if (element.hasTypeElement()) {
58939      composeEnumerationCore("type", element.getTypeElement(),
58940          new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
58941      composeEnumerationExtras("type", element.getTypeElement(),
58942          new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
58943    }
58944    if (element.hasVariableTypeElement()) {
58945      composeEnumerationCore("variableType", element.getVariableTypeElement(),
58946          new ResearchElementDefinition.VariableTypeEnumFactory(), false);
58947      composeEnumerationExtras("variableType", element.getVariableTypeElement(),
58948          new ResearchElementDefinition.VariableTypeEnumFactory(), false);
58949    }
58950    if (element.hasCharacteristic()) {
58951      openArray("characteristic");
58952      for (ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent e : element.getCharacteristic())
58953        composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(null, e);
58954      closeArray();
58955    }
58956    ;
58957  }
58958
58959  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(String name,
58960      ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
58961    if (element != null) {
58962      open(name);
58963      composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(element);
58964      close();
58965    }
58966  }
58967
58968  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(
58969      ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
58970    composeBackbone(element);
58971    if (element.hasDefinition()) {
58972      composeType("definition", element.getDefinition());
58973    }
58974    if (element.hasUsageContext()) {
58975      openArray("usageContext");
58976      for (UsageContext e : element.getUsageContext())
58977        composeUsageContext(null, e);
58978      closeArray();
58979    }
58980    ;
58981    if (element.hasExcludeElement()) {
58982      composeBooleanCore("exclude", element.getExcludeElement(), false);
58983      composeBooleanExtras("exclude", element.getExcludeElement(), false);
58984    }
58985    if (element.hasUnitOfMeasure()) {
58986      composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
58987    }
58988    if (element.hasStudyEffectiveDescriptionElement()) {
58989      composeStringCore("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
58990      composeStringExtras("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
58991    }
58992    if (element.hasStudyEffective()) {
58993      composeType("studyEffective", element.getStudyEffective());
58994    }
58995    if (element.hasStudyEffectiveTimeFromStart()) {
58996      composeDuration("studyEffectiveTimeFromStart", element.getStudyEffectiveTimeFromStart());
58997    }
58998    if (element.hasStudyEffectiveGroupMeasureElement()) {
58999      composeEnumerationCore("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(),
59000          new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
59001      composeEnumerationExtras("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(),
59002          new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
59003    }
59004    if (element.hasParticipantEffectiveDescriptionElement()) {
59005      composeStringCore("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
59006      composeStringExtras("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(),
59007          false);
59008    }
59009    if (element.hasParticipantEffective()) {
59010      composeType("participantEffective", element.getParticipantEffective());
59011    }
59012    if (element.hasParticipantEffectiveTimeFromStart()) {
59013      composeDuration("participantEffectiveTimeFromStart", element.getParticipantEffectiveTimeFromStart());
59014    }
59015    if (element.hasParticipantEffectiveGroupMeasureElement()) {
59016      composeEnumerationCore("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(),
59017          new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
59018      composeEnumerationExtras("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(),
59019          new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
59020    }
59021  }
59022
59023  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
59024    if (element != null) {
59025      prop("resourceType", name);
59026      composeResearchStudyInner(element);
59027    }
59028  }
59029
59030  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
59031    composeDomainResourceElements(element);
59032    if (element.hasIdentifier()) {
59033      openArray("identifier");
59034      for (Identifier e : element.getIdentifier())
59035        composeIdentifier(null, e);
59036      closeArray();
59037    }
59038    ;
59039    if (element.hasTitleElement()) {
59040      composeStringCore("title", element.getTitleElement(), false);
59041      composeStringExtras("title", element.getTitleElement(), false);
59042    }
59043    if (element.hasProtocol()) {
59044      openArray("protocol");
59045      for (Reference e : element.getProtocol())
59046        composeReference(null, e);
59047      closeArray();
59048    }
59049    ;
59050    if (element.hasPartOf()) {
59051      openArray("partOf");
59052      for (Reference e : element.getPartOf())
59053        composeReference(null, e);
59054      closeArray();
59055    }
59056    ;
59057    if (element.hasStatusElement()) {
59058      composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(),
59059          false);
59060      composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(),
59061          false);
59062    }
59063    if (element.hasPrimaryPurposeType()) {
59064      composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
59065    }
59066    if (element.hasPhase()) {
59067      composeCodeableConcept("phase", element.getPhase());
59068    }
59069    if (element.hasCategory()) {
59070      openArray("category");
59071      for (CodeableConcept e : element.getCategory())
59072        composeCodeableConcept(null, e);
59073      closeArray();
59074    }
59075    ;
59076    if (element.hasFocus()) {
59077      openArray("focus");
59078      for (CodeableConcept e : element.getFocus())
59079        composeCodeableConcept(null, e);
59080      closeArray();
59081    }
59082    ;
59083    if (element.hasCondition()) {
59084      openArray("condition");
59085      for (CodeableConcept e : element.getCondition())
59086        composeCodeableConcept(null, e);
59087      closeArray();
59088    }
59089    ;
59090    if (element.hasContact()) {
59091      openArray("contact");
59092      for (ContactDetail e : element.getContact())
59093        composeContactDetail(null, e);
59094      closeArray();
59095    }
59096    ;
59097    if (element.hasRelatedArtifact()) {
59098      openArray("relatedArtifact");
59099      for (RelatedArtifact e : element.getRelatedArtifact())
59100        composeRelatedArtifact(null, e);
59101      closeArray();
59102    }
59103    ;
59104    if (element.hasKeyword()) {
59105      openArray("keyword");
59106      for (CodeableConcept e : element.getKeyword())
59107        composeCodeableConcept(null, e);
59108      closeArray();
59109    }
59110    ;
59111    if (element.hasLocation()) {
59112      openArray("location");
59113      for (CodeableConcept e : element.getLocation())
59114        composeCodeableConcept(null, e);
59115      closeArray();
59116    }
59117    ;
59118    if (element.hasDescriptionElement()) {
59119      composeMarkdownCore("description", element.getDescriptionElement(), false);
59120      composeMarkdownExtras("description", element.getDescriptionElement(), false);
59121    }
59122    if (element.hasEnrollment()) {
59123      openArray("enrollment");
59124      for (Reference e : element.getEnrollment())
59125        composeReference(null, e);
59126      closeArray();
59127    }
59128    ;
59129    if (element.hasPeriod()) {
59130      composePeriod("period", element.getPeriod());
59131    }
59132    if (element.hasSponsor()) {
59133      composeReference("sponsor", element.getSponsor());
59134    }
59135    if (element.hasPrincipalInvestigator()) {
59136      composeReference("principalInvestigator", element.getPrincipalInvestigator());
59137    }
59138    if (element.hasSite()) {
59139      openArray("site");
59140      for (Reference e : element.getSite())
59141        composeReference(null, e);
59142      closeArray();
59143    }
59144    ;
59145    if (element.hasReasonStopped()) {
59146      composeCodeableConcept("reasonStopped", element.getReasonStopped());
59147    }
59148    if (element.hasNote()) {
59149      openArray("note");
59150      for (Annotation e : element.getNote())
59151        composeAnnotation(null, e);
59152      closeArray();
59153    }
59154    ;
59155    if (element.hasArm()) {
59156      openArray("arm");
59157      for (ResearchStudy.ResearchStudyArmComponent e : element.getArm())
59158        composeResearchStudyResearchStudyArmComponent(null, e);
59159      closeArray();
59160    }
59161    ;
59162    if (element.hasObjective()) {
59163      openArray("objective");
59164      for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective())
59165        composeResearchStudyResearchStudyObjectiveComponent(null, e);
59166      closeArray();
59167    }
59168    ;
59169  }
59170
59171  protected void composeResearchStudyResearchStudyArmComponent(String name,
59172      ResearchStudy.ResearchStudyArmComponent element) throws IOException {
59173    if (element != null) {
59174      open(name);
59175      composeResearchStudyResearchStudyArmComponentInner(element);
59176      close();
59177    }
59178  }
59179
59180  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element)
59181      throws IOException {
59182    composeBackbone(element);
59183    if (element.hasNameElement()) {
59184      composeStringCore("name", element.getNameElement(), false);
59185      composeStringExtras("name", element.getNameElement(), false);
59186    }
59187    if (element.hasType()) {
59188      composeCodeableConcept("type", element.getType());
59189    }
59190    if (element.hasDescriptionElement()) {
59191      composeStringCore("description", element.getDescriptionElement(), false);
59192      composeStringExtras("description", element.getDescriptionElement(), false);
59193    }
59194  }
59195
59196  protected void composeResearchStudyResearchStudyObjectiveComponent(String name,
59197      ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
59198    if (element != null) {
59199      open(name);
59200      composeResearchStudyResearchStudyObjectiveComponentInner(element);
59201      close();
59202    }
59203  }
59204
59205  protected void composeResearchStudyResearchStudyObjectiveComponentInner(
59206      ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
59207    composeBackbone(element);
59208    if (element.hasNameElement()) {
59209      composeStringCore("name", element.getNameElement(), false);
59210      composeStringExtras("name", element.getNameElement(), false);
59211    }
59212    if (element.hasType()) {
59213      composeCodeableConcept("type", element.getType());
59214    }
59215  }
59216
59217  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
59218    if (element != null) {
59219      prop("resourceType", name);
59220      composeResearchSubjectInner(element);
59221    }
59222  }
59223
59224  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
59225    composeDomainResourceElements(element);
59226    if (element.hasIdentifier()) {
59227      openArray("identifier");
59228      for (Identifier e : element.getIdentifier())
59229        composeIdentifier(null, e);
59230      closeArray();
59231    }
59232    ;
59233    if (element.hasStatusElement()) {
59234      composeEnumerationCore("status", element.getStatusElement(),
59235          new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
59236      composeEnumerationExtras("status", element.getStatusElement(),
59237          new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
59238    }
59239    if (element.hasPeriod()) {
59240      composePeriod("period", element.getPeriod());
59241    }
59242    if (element.hasStudy()) {
59243      composeReference("study", element.getStudy());
59244    }
59245    if (element.hasIndividual()) {
59246      composeReference("individual", element.getIndividual());
59247    }
59248    if (element.hasAssignedArmElement()) {
59249      composeStringCore("assignedArm", element.getAssignedArmElement(), false);
59250      composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
59251    }
59252    if (element.hasActualArmElement()) {
59253      composeStringCore("actualArm", element.getActualArmElement(), false);
59254      composeStringExtras("actualArm", element.getActualArmElement(), false);
59255    }
59256    if (element.hasConsent()) {
59257      composeReference("consent", element.getConsent());
59258    }
59259  }
59260
59261  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
59262    if (element != null) {
59263      prop("resourceType", name);
59264      composeRiskAssessmentInner(element);
59265    }
59266  }
59267
59268  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
59269    composeDomainResourceElements(element);
59270    if (element.hasIdentifier()) {
59271      openArray("identifier");
59272      for (Identifier e : element.getIdentifier())
59273        composeIdentifier(null, e);
59274      closeArray();
59275    }
59276    ;
59277    if (element.hasBasedOn()) {
59278      composeReference("basedOn", element.getBasedOn());
59279    }
59280    if (element.hasParent()) {
59281      composeReference("parent", element.getParent());
59282    }
59283    if (element.hasStatusElement()) {
59284      composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(),
59285          false);
59286      composeEnumerationExtras("status", element.getStatusElement(),
59287          new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
59288    }
59289    if (element.hasMethod()) {
59290      composeCodeableConcept("method", element.getMethod());
59291    }
59292    if (element.hasCode()) {
59293      composeCodeableConcept("code", element.getCode());
59294    }
59295    if (element.hasSubject()) {
59296      composeReference("subject", element.getSubject());
59297    }
59298    if (element.hasEncounter()) {
59299      composeReference("encounter", element.getEncounter());
59300    }
59301    if (element.hasOccurrence()) {
59302      composeType("occurrence", element.getOccurrence());
59303    }
59304    if (element.hasCondition()) {
59305      composeReference("condition", element.getCondition());
59306    }
59307    if (element.hasPerformer()) {
59308      composeReference("performer", element.getPerformer());
59309    }
59310    if (element.hasReasonCode()) {
59311      openArray("reasonCode");
59312      for (CodeableConcept e : element.getReasonCode())
59313        composeCodeableConcept(null, e);
59314      closeArray();
59315    }
59316    ;
59317    if (element.hasReasonReference()) {
59318      openArray("reasonReference");
59319      for (Reference e : element.getReasonReference())
59320        composeReference(null, e);
59321      closeArray();
59322    }
59323    ;
59324    if (element.hasBasis()) {
59325      openArray("basis");
59326      for (Reference e : element.getBasis())
59327        composeReference(null, e);
59328      closeArray();
59329    }
59330    ;
59331    if (element.hasPrediction()) {
59332      openArray("prediction");
59333      for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction())
59334        composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
59335      closeArray();
59336    }
59337    ;
59338    if (element.hasMitigationElement()) {
59339      composeStringCore("mitigation", element.getMitigationElement(), false);
59340      composeStringExtras("mitigation", element.getMitigationElement(), false);
59341    }
59342    if (element.hasNote()) {
59343      openArray("note");
59344      for (Annotation e : element.getNote())
59345        composeAnnotation(null, e);
59346      closeArray();
59347    }
59348    ;
59349  }
59350
59351  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name,
59352      RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
59353    if (element != null) {
59354      open(name);
59355      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
59356      close();
59357    }
59358  }
59359
59360  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(
59361      RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
59362    composeBackbone(element);
59363    if (element.hasOutcome()) {
59364      composeCodeableConcept("outcome", element.getOutcome());
59365    }
59366    if (element.hasProbability()) {
59367      composeType("probability", element.getProbability());
59368    }
59369    if (element.hasQualitativeRisk()) {
59370      composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
59371    }
59372    if (element.hasRelativeRiskElement()) {
59373      composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
59374      composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
59375    }
59376    if (element.hasWhen()) {
59377      composeType("when", element.getWhen());
59378    }
59379    if (element.hasRationaleElement()) {
59380      composeStringCore("rationale", element.getRationaleElement(), false);
59381      composeStringExtras("rationale", element.getRationaleElement(), false);
59382    }
59383  }
59384
59385  protected void composeRiskEvidenceSynthesis(String name, RiskEvidenceSynthesis element) throws IOException {
59386    if (element != null) {
59387      prop("resourceType", name);
59388      composeRiskEvidenceSynthesisInner(element);
59389    }
59390  }
59391
59392  protected void composeRiskEvidenceSynthesisInner(RiskEvidenceSynthesis element) throws IOException {
59393    composeDomainResourceElements(element);
59394    if (element.hasUrlElement()) {
59395      composeUriCore("url", element.getUrlElement(), false);
59396      composeUriExtras("url", element.getUrlElement(), false);
59397    }
59398    if (element.hasIdentifier()) {
59399      openArray("identifier");
59400      for (Identifier e : element.getIdentifier())
59401        composeIdentifier(null, e);
59402      closeArray();
59403    }
59404    ;
59405    if (element.hasVersionElement()) {
59406      composeStringCore("version", element.getVersionElement(), false);
59407      composeStringExtras("version", element.getVersionElement(), false);
59408    }
59409    if (element.hasNameElement()) {
59410      composeStringCore("name", element.getNameElement(), false);
59411      composeStringExtras("name", element.getNameElement(), false);
59412    }
59413    if (element.hasTitleElement()) {
59414      composeStringCore("title", element.getTitleElement(), false);
59415      composeStringExtras("title", element.getTitleElement(), false);
59416    }
59417    if (element.hasStatusElement()) {
59418      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
59419          false);
59420      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
59421          false);
59422    }
59423    if (element.hasDateElement()) {
59424      composeDateTimeCore("date", element.getDateElement(), false);
59425      composeDateTimeExtras("date", element.getDateElement(), false);
59426    }
59427    if (element.hasPublisherElement()) {
59428      composeStringCore("publisher", element.getPublisherElement(), false);
59429      composeStringExtras("publisher", element.getPublisherElement(), false);
59430    }
59431    if (element.hasContact()) {
59432      openArray("contact");
59433      for (ContactDetail e : element.getContact())
59434        composeContactDetail(null, e);
59435      closeArray();
59436    }
59437    ;
59438    if (element.hasDescriptionElement()) {
59439      composeMarkdownCore("description", element.getDescriptionElement(), false);
59440      composeMarkdownExtras("description", element.getDescriptionElement(), false);
59441    }
59442    if (element.hasNote()) {
59443      openArray("note");
59444      for (Annotation e : element.getNote())
59445        composeAnnotation(null, e);
59446      closeArray();
59447    }
59448    ;
59449    if (element.hasUseContext()) {
59450      openArray("useContext");
59451      for (UsageContext e : element.getUseContext())
59452        composeUsageContext(null, e);
59453      closeArray();
59454    }
59455    ;
59456    if (element.hasJurisdiction()) {
59457      openArray("jurisdiction");
59458      for (CodeableConcept e : element.getJurisdiction())
59459        composeCodeableConcept(null, e);
59460      closeArray();
59461    }
59462    ;
59463    if (element.hasCopyrightElement()) {
59464      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
59465      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
59466    }
59467    if (element.hasApprovalDateElement()) {
59468      composeDateCore("approvalDate", element.getApprovalDateElement(), false);
59469      composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
59470    }
59471    if (element.hasLastReviewDateElement()) {
59472      composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
59473      composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
59474    }
59475    if (element.hasEffectivePeriod()) {
59476      composePeriod("effectivePeriod", element.getEffectivePeriod());
59477    }
59478    if (element.hasTopic()) {
59479      openArray("topic");
59480      for (CodeableConcept e : element.getTopic())
59481        composeCodeableConcept(null, e);
59482      closeArray();
59483    }
59484    ;
59485    if (element.hasAuthor()) {
59486      openArray("author");
59487      for (ContactDetail e : element.getAuthor())
59488        composeContactDetail(null, e);
59489      closeArray();
59490    }
59491    ;
59492    if (element.hasEditor()) {
59493      openArray("editor");
59494      for (ContactDetail e : element.getEditor())
59495        composeContactDetail(null, e);
59496      closeArray();
59497    }
59498    ;
59499    if (element.hasReviewer()) {
59500      openArray("reviewer");
59501      for (ContactDetail e : element.getReviewer())
59502        composeContactDetail(null, e);
59503      closeArray();
59504    }
59505    ;
59506    if (element.hasEndorser()) {
59507      openArray("endorser");
59508      for (ContactDetail e : element.getEndorser())
59509        composeContactDetail(null, e);
59510      closeArray();
59511    }
59512    ;
59513    if (element.hasRelatedArtifact()) {
59514      openArray("relatedArtifact");
59515      for (RelatedArtifact e : element.getRelatedArtifact())
59516        composeRelatedArtifact(null, e);
59517      closeArray();
59518    }
59519    ;
59520    if (element.hasSynthesisType()) {
59521      composeCodeableConcept("synthesisType", element.getSynthesisType());
59522    }
59523    if (element.hasStudyType()) {
59524      composeCodeableConcept("studyType", element.getStudyType());
59525    }
59526    if (element.hasPopulation()) {
59527      composeReference("population", element.getPopulation());
59528    }
59529    if (element.hasExposure()) {
59530      composeReference("exposure", element.getExposure());
59531    }
59532    if (element.hasOutcome()) {
59533      composeReference("outcome", element.getOutcome());
59534    }
59535    if (element.hasSampleSize()) {
59536      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
59537    }
59538    if (element.hasRiskEstimate()) {
59539      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent("riskEstimate", element.getRiskEstimate());
59540    }
59541    if (element.hasCertainty()) {
59542      openArray("certainty");
59543      for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent e : element.getCertainty())
59544        composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(null, e);
59545      closeArray();
59546    }
59547    ;
59548  }
59549
59550  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(String name,
59551      RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
59552    if (element != null) {
59553      open(name);
59554      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(element);
59555      close();
59556    }
59557  }
59558
59559  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(
59560      RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
59561    composeBackbone(element);
59562    if (element.hasDescriptionElement()) {
59563      composeStringCore("description", element.getDescriptionElement(), false);
59564      composeStringExtras("description", element.getDescriptionElement(), false);
59565    }
59566    if (element.hasNumberOfStudiesElement()) {
59567      composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
59568      composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
59569    }
59570    if (element.hasNumberOfParticipantsElement()) {
59571      composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
59572      composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
59573    }
59574  }
59575
59576  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(String name,
59577      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
59578    if (element != null) {
59579      open(name);
59580      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(element);
59581      close();
59582    }
59583  }
59584
59585  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(
59586      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
59587    composeBackbone(element);
59588    if (element.hasDescriptionElement()) {
59589      composeStringCore("description", element.getDescriptionElement(), false);
59590      composeStringExtras("description", element.getDescriptionElement(), false);
59591    }
59592    if (element.hasType()) {
59593      composeCodeableConcept("type", element.getType());
59594    }
59595    if (element.hasValueElement()) {
59596      composeDecimalCore("value", element.getValueElement(), false);
59597      composeDecimalExtras("value", element.getValueElement(), false);
59598    }
59599    if (element.hasUnitOfMeasure()) {
59600      composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
59601    }
59602    if (element.hasDenominatorCountElement()) {
59603      composeIntegerCore("denominatorCount", element.getDenominatorCountElement(), false);
59604      composeIntegerExtras("denominatorCount", element.getDenominatorCountElement(), false);
59605    }
59606    if (element.hasNumeratorCountElement()) {
59607      composeIntegerCore("numeratorCount", element.getNumeratorCountElement(), false);
59608      composeIntegerExtras("numeratorCount", element.getNumeratorCountElement(), false);
59609    }
59610    if (element.hasPrecisionEstimate()) {
59611      openArray("precisionEstimate");
59612      for (RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent e : element
59613          .getPrecisionEstimate())
59614        composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(null, e);
59615      closeArray();
59616    }
59617    ;
59618  }
59619
59620  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(String name,
59621      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
59622    if (element != null) {
59623      open(name);
59624      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(element);
59625      close();
59626    }
59627  }
59628
59629  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(
59630      RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
59631    composeBackbone(element);
59632    if (element.hasType()) {
59633      composeCodeableConcept("type", element.getType());
59634    }
59635    if (element.hasLevelElement()) {
59636      composeDecimalCore("level", element.getLevelElement(), false);
59637      composeDecimalExtras("level", element.getLevelElement(), false);
59638    }
59639    if (element.hasFromElement()) {
59640      composeDecimalCore("from", element.getFromElement(), false);
59641      composeDecimalExtras("from", element.getFromElement(), false);
59642    }
59643    if (element.hasToElement()) {
59644      composeDecimalCore("to", element.getToElement(), false);
59645      composeDecimalExtras("to", element.getToElement(), false);
59646    }
59647  }
59648
59649  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(String name,
59650      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
59651    if (element != null) {
59652      open(name);
59653      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(element);
59654      close();
59655    }
59656  }
59657
59658  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(
59659      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
59660    composeBackbone(element);
59661    if (element.hasRating()) {
59662      openArray("rating");
59663      for (CodeableConcept e : element.getRating())
59664        composeCodeableConcept(null, e);
59665      closeArray();
59666    }
59667    ;
59668    if (element.hasNote()) {
59669      openArray("note");
59670      for (Annotation e : element.getNote())
59671        composeAnnotation(null, e);
59672      closeArray();
59673    }
59674    ;
59675    if (element.hasCertaintySubcomponent()) {
59676      openArray("certaintySubcomponent");
59677      for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element
59678          .getCertaintySubcomponent())
59679        composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
59680      closeArray();
59681    }
59682    ;
59683  }
59684
59685  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name,
59686      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
59687    if (element != null) {
59688      open(name);
59689      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
59690      close();
59691    }
59692  }
59693
59694  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(
59695      RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
59696    composeBackbone(element);
59697    if (element.hasType()) {
59698      composeCodeableConcept("type", element.getType());
59699    }
59700    if (element.hasRating()) {
59701      openArray("rating");
59702      for (CodeableConcept e : element.getRating())
59703        composeCodeableConcept(null, e);
59704      closeArray();
59705    }
59706    ;
59707    if (element.hasNote()) {
59708      openArray("note");
59709      for (Annotation e : element.getNote())
59710        composeAnnotation(null, e);
59711      closeArray();
59712    }
59713    ;
59714  }
59715
59716  protected void composeSchedule(String name, Schedule element) throws IOException {
59717    if (element != null) {
59718      prop("resourceType", name);
59719      composeScheduleInner(element);
59720    }
59721  }
59722
59723  protected void composeScheduleInner(Schedule element) throws IOException {
59724    composeDomainResourceElements(element);
59725    if (element.hasIdentifier()) {
59726      openArray("identifier");
59727      for (Identifier e : element.getIdentifier())
59728        composeIdentifier(null, e);
59729      closeArray();
59730    }
59731    ;
59732    if (element.hasActiveElement()) {
59733      composeBooleanCore("active", element.getActiveElement(), false);
59734      composeBooleanExtras("active", element.getActiveElement(), false);
59735    }
59736    if (element.hasServiceCategory()) {
59737      openArray("serviceCategory");
59738      for (CodeableConcept e : element.getServiceCategory())
59739        composeCodeableConcept(null, e);
59740      closeArray();
59741    }
59742    ;
59743    if (element.hasServiceType()) {
59744      openArray("serviceType");
59745      for (CodeableConcept e : element.getServiceType())
59746        composeCodeableConcept(null, e);
59747      closeArray();
59748    }
59749    ;
59750    if (element.hasSpecialty()) {
59751      openArray("specialty");
59752      for (CodeableConcept e : element.getSpecialty())
59753        composeCodeableConcept(null, e);
59754      closeArray();
59755    }
59756    ;
59757    if (element.hasActor()) {
59758      openArray("actor");
59759      for (Reference e : element.getActor())
59760        composeReference(null, e);
59761      closeArray();
59762    }
59763    ;
59764    if (element.hasPlanningHorizon()) {
59765      composePeriod("planningHorizon", element.getPlanningHorizon());
59766    }
59767    if (element.hasCommentElement()) {
59768      composeStringCore("comment", element.getCommentElement(), false);
59769      composeStringExtras("comment", element.getCommentElement(), false);
59770    }
59771  }
59772
59773  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
59774    if (element != null) {
59775      prop("resourceType", name);
59776      composeSearchParameterInner(element);
59777    }
59778  }
59779
59780  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
59781    composeDomainResourceElements(element);
59782    if (element.hasUrlElement()) {
59783      composeUriCore("url", element.getUrlElement(), false);
59784      composeUriExtras("url", element.getUrlElement(), false);
59785    }
59786    if (element.hasVersionElement()) {
59787      composeStringCore("version", element.getVersionElement(), false);
59788      composeStringExtras("version", element.getVersionElement(), false);
59789    }
59790    if (element.hasNameElement()) {
59791      composeStringCore("name", element.getNameElement(), false);
59792      composeStringExtras("name", element.getNameElement(), false);
59793    }
59794    if (element.hasDerivedFromElement()) {
59795      composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
59796      composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
59797    }
59798    if (element.hasStatusElement()) {
59799      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
59800          false);
59801      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
59802          false);
59803    }
59804    if (element.hasExperimentalElement()) {
59805      composeBooleanCore("experimental", element.getExperimentalElement(), false);
59806      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
59807    }
59808    if (element.hasDateElement()) {
59809      composeDateTimeCore("date", element.getDateElement(), false);
59810      composeDateTimeExtras("date", element.getDateElement(), false);
59811    }
59812    if (element.hasPublisherElement()) {
59813      composeStringCore("publisher", element.getPublisherElement(), false);
59814      composeStringExtras("publisher", element.getPublisherElement(), false);
59815    }
59816    if (element.hasContact()) {
59817      openArray("contact");
59818      for (ContactDetail e : element.getContact())
59819        composeContactDetail(null, e);
59820      closeArray();
59821    }
59822    ;
59823    if (element.hasDescriptionElement()) {
59824      composeMarkdownCore("description", element.getDescriptionElement(), false);
59825      composeMarkdownExtras("description", element.getDescriptionElement(), false);
59826    }
59827    if (element.hasUseContext()) {
59828      openArray("useContext");
59829      for (UsageContext e : element.getUseContext())
59830        composeUsageContext(null, e);
59831      closeArray();
59832    }
59833    ;
59834    if (element.hasJurisdiction()) {
59835      openArray("jurisdiction");
59836      for (CodeableConcept e : element.getJurisdiction())
59837        composeCodeableConcept(null, e);
59838      closeArray();
59839    }
59840    ;
59841    if (element.hasPurposeElement()) {
59842      composeMarkdownCore("purpose", element.getPurposeElement(), false);
59843      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
59844    }
59845    if (element.hasCodeElement()) {
59846      composeCodeCore("code", element.getCodeElement(), false);
59847      composeCodeExtras("code", element.getCodeElement(), false);
59848    }
59849    if (element.hasBase()) {
59850      openArray("base");
59851      for (CodeType e : element.getBase())
59852        composeCodeCore(null, e, true);
59853      closeArray();
59854      if (anyHasExtras(element.getBase())) {
59855        openArray("_base");
59856        for (CodeType e : element.getBase())
59857          composeCodeExtras(null, e, true);
59858        closeArray();
59859      }
59860    }
59861    ;
59862    if (element.hasTypeElement()) {
59863      composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
59864      composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
59865    }
59866    if (element.hasExpressionElement()) {
59867      composeStringCore("expression", element.getExpressionElement(), false);
59868      composeStringExtras("expression", element.getExpressionElement(), false);
59869    }
59870    if (element.hasXpathElement()) {
59871      composeStringCore("xpath", element.getXpathElement(), false);
59872      composeStringExtras("xpath", element.getXpathElement(), false);
59873    }
59874    if (element.hasXpathUsageElement()) {
59875      composeEnumerationCore("xpathUsage", element.getXpathUsageElement(),
59876          new SearchParameter.XPathUsageTypeEnumFactory(), false);
59877      composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(),
59878          new SearchParameter.XPathUsageTypeEnumFactory(), false);
59879    }
59880    if (element.hasTarget()) {
59881      openArray("target");
59882      for (CodeType e : element.getTarget())
59883        composeCodeCore(null, e, true);
59884      closeArray();
59885      if (anyHasExtras(element.getTarget())) {
59886        openArray("_target");
59887        for (CodeType e : element.getTarget())
59888          composeCodeExtras(null, e, true);
59889        closeArray();
59890      }
59891    }
59892    ;
59893    if (element.hasMultipleOrElement()) {
59894      composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
59895      composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
59896    }
59897    if (element.hasMultipleAndElement()) {
59898      composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
59899      composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
59900    }
59901    if (element.hasComparator()) {
59902      openArray("comparator");
59903      for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator())
59904        composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
59905      closeArray();
59906      if (anyHasExtras(element.getComparator())) {
59907        openArray("_comparator");
59908        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator())
59909          composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
59910        closeArray();
59911      }
59912    }
59913    ;
59914    if (element.hasModifier()) {
59915      openArray("modifier");
59916      for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier())
59917        composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
59918      closeArray();
59919      if (anyHasExtras(element.getModifier())) {
59920        openArray("_modifier");
59921        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier())
59922          composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
59923        closeArray();
59924      }
59925    }
59926    ;
59927    if (element.hasChain()) {
59928      openArray("chain");
59929      for (StringType e : element.getChain())
59930        composeStringCore(null, e, true);
59931      closeArray();
59932      if (anyHasExtras(element.getChain())) {
59933        openArray("_chain");
59934        for (StringType e : element.getChain())
59935          composeStringExtras(null, e, true);
59936        closeArray();
59937      }
59938    }
59939    ;
59940    if (element.hasComponent()) {
59941      openArray("component");
59942      for (SearchParameter.SearchParameterComponentComponent e : element.getComponent())
59943        composeSearchParameterSearchParameterComponentComponent(null, e);
59944      closeArray();
59945    }
59946    ;
59947  }
59948
59949  protected void composeSearchParameterSearchParameterComponentComponent(String name,
59950      SearchParameter.SearchParameterComponentComponent element) throws IOException {
59951    if (element != null) {
59952      open(name);
59953      composeSearchParameterSearchParameterComponentComponentInner(element);
59954      close();
59955    }
59956  }
59957
59958  protected void composeSearchParameterSearchParameterComponentComponentInner(
59959      SearchParameter.SearchParameterComponentComponent element) throws IOException {
59960    composeBackbone(element);
59961    if (element.hasDefinitionElement()) {
59962      composeCanonicalCore("definition", element.getDefinitionElement(), false);
59963      composeCanonicalExtras("definition", element.getDefinitionElement(), false);
59964    }
59965    if (element.hasExpressionElement()) {
59966      composeStringCore("expression", element.getExpressionElement(), false);
59967      composeStringExtras("expression", element.getExpressionElement(), false);
59968    }
59969  }
59970
59971  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
59972    if (element != null) {
59973      prop("resourceType", name);
59974      composeServiceRequestInner(element);
59975    }
59976  }
59977
59978  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
59979    composeDomainResourceElements(element);
59980    if (element.hasIdentifier()) {
59981      openArray("identifier");
59982      for (Identifier e : element.getIdentifier())
59983        composeIdentifier(null, e);
59984      closeArray();
59985    }
59986    ;
59987    if (element.hasInstantiatesCanonical()) {
59988      openArray("instantiatesCanonical");
59989      for (CanonicalType e : element.getInstantiatesCanonical())
59990        composeCanonicalCore(null, e, true);
59991      closeArray();
59992      if (anyHasExtras(element.getInstantiatesCanonical())) {
59993        openArray("_instantiatesCanonical");
59994        for (CanonicalType e : element.getInstantiatesCanonical())
59995          composeCanonicalExtras(null, e, true);
59996        closeArray();
59997      }
59998    }
59999    ;
60000    if (element.hasInstantiatesUri()) {
60001      openArray("instantiatesUri");
60002      for (UriType e : element.getInstantiatesUri())
60003        composeUriCore(null, e, true);
60004      closeArray();
60005      if (anyHasExtras(element.getInstantiatesUri())) {
60006        openArray("_instantiatesUri");
60007        for (UriType e : element.getInstantiatesUri())
60008          composeUriExtras(null, e, true);
60009        closeArray();
60010      }
60011    }
60012    ;
60013    if (element.hasBasedOn()) {
60014      openArray("basedOn");
60015      for (Reference e : element.getBasedOn())
60016        composeReference(null, e);
60017      closeArray();
60018    }
60019    ;
60020    if (element.hasReplaces()) {
60021      openArray("replaces");
60022      for (Reference e : element.getReplaces())
60023        composeReference(null, e);
60024      closeArray();
60025    }
60026    ;
60027    if (element.hasRequisition()) {
60028      composeIdentifier("requisition", element.getRequisition());
60029    }
60030    if (element.hasStatusElement()) {
60031      composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(),
60032          false);
60033      composeEnumerationExtras("status", element.getStatusElement(),
60034          new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
60035    }
60036    if (element.hasIntentElement()) {
60037      composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(),
60038          false);
60039      composeEnumerationExtras("intent", element.getIntentElement(),
60040          new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
60041    }
60042    if (element.hasCategory()) {
60043      openArray("category");
60044      for (CodeableConcept e : element.getCategory())
60045        composeCodeableConcept(null, e);
60046      closeArray();
60047    }
60048    ;
60049    if (element.hasPriorityElement()) {
60050      composeEnumerationCore("priority", element.getPriorityElement(),
60051          new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
60052      composeEnumerationExtras("priority", element.getPriorityElement(),
60053          new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
60054    }
60055    if (element.hasDoNotPerformElement()) {
60056      composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
60057      composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
60058    }
60059    if (element.hasCode()) {
60060      composeCodeableConcept("code", element.getCode());
60061    }
60062    if (element.hasOrderDetail()) {
60063      openArray("orderDetail");
60064      for (CodeableConcept e : element.getOrderDetail())
60065        composeCodeableConcept(null, e);
60066      closeArray();
60067    }
60068    ;
60069    if (element.hasQuantity()) {
60070      composeType("quantity", element.getQuantity());
60071    }
60072    if (element.hasSubject()) {
60073      composeReference("subject", element.getSubject());
60074    }
60075    if (element.hasEncounter()) {
60076      composeReference("encounter", element.getEncounter());
60077    }
60078    if (element.hasOccurrence()) {
60079      composeType("occurrence", element.getOccurrence());
60080    }
60081    if (element.hasAsNeeded()) {
60082      composeType("asNeeded", element.getAsNeeded());
60083    }
60084    if (element.hasAuthoredOnElement()) {
60085      composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
60086      composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
60087    }
60088    if (element.hasRequester()) {
60089      composeReference("requester", element.getRequester());
60090    }
60091    if (element.hasPerformerType()) {
60092      composeCodeableConcept("performerType", element.getPerformerType());
60093    }
60094    if (element.hasPerformer()) {
60095      openArray("performer");
60096      for (Reference e : element.getPerformer())
60097        composeReference(null, e);
60098      closeArray();
60099    }
60100    ;
60101    if (element.hasLocationCode()) {
60102      openArray("locationCode");
60103      for (CodeableConcept e : element.getLocationCode())
60104        composeCodeableConcept(null, e);
60105      closeArray();
60106    }
60107    ;
60108    if (element.hasLocationReference()) {
60109      openArray("locationReference");
60110      for (Reference e : element.getLocationReference())
60111        composeReference(null, e);
60112      closeArray();
60113    }
60114    ;
60115    if (element.hasReasonCode()) {
60116      openArray("reasonCode");
60117      for (CodeableConcept e : element.getReasonCode())
60118        composeCodeableConcept(null, e);
60119      closeArray();
60120    }
60121    ;
60122    if (element.hasReasonReference()) {
60123      openArray("reasonReference");
60124      for (Reference e : element.getReasonReference())
60125        composeReference(null, e);
60126      closeArray();
60127    }
60128    ;
60129    if (element.hasInsurance()) {
60130      openArray("insurance");
60131      for (Reference e : element.getInsurance())
60132        composeReference(null, e);
60133      closeArray();
60134    }
60135    ;
60136    if (element.hasSupportingInfo()) {
60137      openArray("supportingInfo");
60138      for (Reference e : element.getSupportingInfo())
60139        composeReference(null, e);
60140      closeArray();
60141    }
60142    ;
60143    if (element.hasSpecimen()) {
60144      openArray("specimen");
60145      for (Reference e : element.getSpecimen())
60146        composeReference(null, e);
60147      closeArray();
60148    }
60149    ;
60150    if (element.hasBodySite()) {
60151      openArray("bodySite");
60152      for (CodeableConcept e : element.getBodySite())
60153        composeCodeableConcept(null, e);
60154      closeArray();
60155    }
60156    ;
60157    if (element.hasNote()) {
60158      openArray("note");
60159      for (Annotation e : element.getNote())
60160        composeAnnotation(null, e);
60161      closeArray();
60162    }
60163    ;
60164    if (element.hasPatientInstructionElement()) {
60165      composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
60166      composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
60167    }
60168    if (element.hasRelevantHistory()) {
60169      openArray("relevantHistory");
60170      for (Reference e : element.getRelevantHistory())
60171        composeReference(null, e);
60172      closeArray();
60173    }
60174    ;
60175  }
60176
60177  protected void composeSlot(String name, Slot element) throws IOException {
60178    if (element != null) {
60179      prop("resourceType", name);
60180      composeSlotInner(element);
60181    }
60182  }
60183
60184  protected void composeSlotInner(Slot element) throws IOException {
60185    composeDomainResourceElements(element);
60186    if (element.hasIdentifier()) {
60187      openArray("identifier");
60188      for (Identifier e : element.getIdentifier())
60189        composeIdentifier(null, e);
60190      closeArray();
60191    }
60192    ;
60193    if (element.hasServiceCategory()) {
60194      openArray("serviceCategory");
60195      for (CodeableConcept e : element.getServiceCategory())
60196        composeCodeableConcept(null, e);
60197      closeArray();
60198    }
60199    ;
60200    if (element.hasServiceType()) {
60201      openArray("serviceType");
60202      for (CodeableConcept e : element.getServiceType())
60203        composeCodeableConcept(null, e);
60204      closeArray();
60205    }
60206    ;
60207    if (element.hasSpecialty()) {
60208      openArray("specialty");
60209      for (CodeableConcept e : element.getSpecialty())
60210        composeCodeableConcept(null, e);
60211      closeArray();
60212    }
60213    ;
60214    if (element.hasAppointmentType()) {
60215      composeCodeableConcept("appointmentType", element.getAppointmentType());
60216    }
60217    if (element.hasSchedule()) {
60218      composeReference("schedule", element.getSchedule());
60219    }
60220    if (element.hasStatusElement()) {
60221      composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
60222      composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
60223    }
60224    if (element.hasStartElement()) {
60225      composeInstantCore("start", element.getStartElement(), false);
60226      composeInstantExtras("start", element.getStartElement(), false);
60227    }
60228    if (element.hasEndElement()) {
60229      composeInstantCore("end", element.getEndElement(), false);
60230      composeInstantExtras("end", element.getEndElement(), false);
60231    }
60232    if (element.hasOverbookedElement()) {
60233      composeBooleanCore("overbooked", element.getOverbookedElement(), false);
60234      composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
60235    }
60236    if (element.hasCommentElement()) {
60237      composeStringCore("comment", element.getCommentElement(), false);
60238      composeStringExtras("comment", element.getCommentElement(), false);
60239    }
60240  }
60241
60242  protected void composeSpecimen(String name, Specimen element) throws IOException {
60243    if (element != null) {
60244      prop("resourceType", name);
60245      composeSpecimenInner(element);
60246    }
60247  }
60248
60249  protected void composeSpecimenInner(Specimen element) throws IOException {
60250    composeDomainResourceElements(element);
60251    if (element.hasIdentifier()) {
60252      openArray("identifier");
60253      for (Identifier e : element.getIdentifier())
60254        composeIdentifier(null, e);
60255      closeArray();
60256    }
60257    ;
60258    if (element.hasAccessionIdentifier()) {
60259      composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
60260    }
60261    if (element.hasStatusElement()) {
60262      composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
60263      composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
60264    }
60265    if (element.hasType()) {
60266      composeCodeableConcept("type", element.getType());
60267    }
60268    if (element.hasSubject()) {
60269      composeReference("subject", element.getSubject());
60270    }
60271    if (element.hasReceivedTimeElement()) {
60272      composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
60273      composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
60274    }
60275    if (element.hasParent()) {
60276      openArray("parent");
60277      for (Reference e : element.getParent())
60278        composeReference(null, e);
60279      closeArray();
60280    }
60281    ;
60282    if (element.hasRequest()) {
60283      openArray("request");
60284      for (Reference e : element.getRequest())
60285        composeReference(null, e);
60286      closeArray();
60287    }
60288    ;
60289    if (element.hasCollection()) {
60290      composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
60291    }
60292    if (element.hasProcessing()) {
60293      openArray("processing");
60294      for (Specimen.SpecimenProcessingComponent e : element.getProcessing())
60295        composeSpecimenSpecimenProcessingComponent(null, e);
60296      closeArray();
60297    }
60298    ;
60299    if (element.hasContainer()) {
60300      openArray("container");
60301      for (Specimen.SpecimenContainerComponent e : element.getContainer())
60302        composeSpecimenSpecimenContainerComponent(null, e);
60303      closeArray();
60304    }
60305    ;
60306    if (element.hasCondition()) {
60307      openArray("condition");
60308      for (CodeableConcept e : element.getCondition())
60309        composeCodeableConcept(null, e);
60310      closeArray();
60311    }
60312    ;
60313    if (element.hasNote()) {
60314      openArray("note");
60315      for (Annotation e : element.getNote())
60316        composeAnnotation(null, e);
60317      closeArray();
60318    }
60319    ;
60320  }
60321
60322  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element)
60323      throws IOException {
60324    if (element != null) {
60325      open(name);
60326      composeSpecimenSpecimenCollectionComponentInner(element);
60327      close();
60328    }
60329  }
60330
60331  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element)
60332      throws IOException {
60333    composeBackbone(element);
60334    if (element.hasCollector()) {
60335      composeReference("collector", element.getCollector());
60336    }
60337    if (element.hasCollected()) {
60338      composeType("collected", element.getCollected());
60339    }
60340    if (element.hasDuration()) {
60341      composeDuration("duration", element.getDuration());
60342    }
60343    if (element.hasQuantity()) {
60344      composeQuantity("quantity", element.getQuantity());
60345    }
60346    if (element.hasMethod()) {
60347      composeCodeableConcept("method", element.getMethod());
60348    }
60349    if (element.hasBodySite()) {
60350      composeCodeableConcept("bodySite", element.getBodySite());
60351    }
60352    if (element.hasFastingStatus()) {
60353      composeType("fastingStatus", element.getFastingStatus());
60354    }
60355  }
60356
60357  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element)
60358      throws IOException {
60359    if (element != null) {
60360      open(name);
60361      composeSpecimenSpecimenProcessingComponentInner(element);
60362      close();
60363    }
60364  }
60365
60366  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element)
60367      throws IOException {
60368    composeBackbone(element);
60369    if (element.hasDescriptionElement()) {
60370      composeStringCore("description", element.getDescriptionElement(), false);
60371      composeStringExtras("description", element.getDescriptionElement(), false);
60372    }
60373    if (element.hasProcedure()) {
60374      composeCodeableConcept("procedure", element.getProcedure());
60375    }
60376    if (element.hasAdditive()) {
60377      openArray("additive");
60378      for (Reference e : element.getAdditive())
60379        composeReference(null, e);
60380      closeArray();
60381    }
60382    ;
60383    if (element.hasTime()) {
60384      composeType("time", element.getTime());
60385    }
60386  }
60387
60388  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element)
60389      throws IOException {
60390    if (element != null) {
60391      open(name);
60392      composeSpecimenSpecimenContainerComponentInner(element);
60393      close();
60394    }
60395  }
60396
60397  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element)
60398      throws IOException {
60399    composeBackbone(element);
60400    if (element.hasIdentifier()) {
60401      openArray("identifier");
60402      for (Identifier e : element.getIdentifier())
60403        composeIdentifier(null, e);
60404      closeArray();
60405    }
60406    ;
60407    if (element.hasDescriptionElement()) {
60408      composeStringCore("description", element.getDescriptionElement(), false);
60409      composeStringExtras("description", element.getDescriptionElement(), false);
60410    }
60411    if (element.hasType()) {
60412      composeCodeableConcept("type", element.getType());
60413    }
60414    if (element.hasCapacity()) {
60415      composeQuantity("capacity", element.getCapacity());
60416    }
60417    if (element.hasSpecimenQuantity()) {
60418      composeQuantity("specimenQuantity", element.getSpecimenQuantity());
60419    }
60420    if (element.hasAdditive()) {
60421      composeType("additive", element.getAdditive());
60422    }
60423  }
60424
60425  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
60426    if (element != null) {
60427      prop("resourceType", name);
60428      composeSpecimenDefinitionInner(element);
60429    }
60430  }
60431
60432  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
60433    composeDomainResourceElements(element);
60434    if (element.hasIdentifier()) {
60435      composeIdentifier("identifier", element.getIdentifier());
60436    }
60437    if (element.hasTypeCollected()) {
60438      composeCodeableConcept("typeCollected", element.getTypeCollected());
60439    }
60440    if (element.hasPatientPreparation()) {
60441      openArray("patientPreparation");
60442      for (CodeableConcept e : element.getPatientPreparation())
60443        composeCodeableConcept(null, e);
60444      closeArray();
60445    }
60446    ;
60447    if (element.hasTimeAspectElement()) {
60448      composeStringCore("timeAspect", element.getTimeAspectElement(), false);
60449      composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
60450    }
60451    if (element.hasCollection()) {
60452      openArray("collection");
60453      for (CodeableConcept e : element.getCollection())
60454        composeCodeableConcept(null, e);
60455      closeArray();
60456    }
60457    ;
60458    if (element.hasTypeTested()) {
60459      openArray("typeTested");
60460      for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested())
60461        composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(null, e);
60462      closeArray();
60463    }
60464    ;
60465  }
60466
60467  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name,
60468      SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
60469    if (element != null) {
60470      open(name);
60471      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(element);
60472      close();
60473    }
60474  }
60475
60476  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(
60477      SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
60478    composeBackbone(element);
60479    if (element.hasIsDerivedElement()) {
60480      composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
60481      composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
60482    }
60483    if (element.hasType()) {
60484      composeCodeableConcept("type", element.getType());
60485    }
60486    if (element.hasPreferenceElement()) {
60487      composeEnumerationCore("preference", element.getPreferenceElement(),
60488          new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
60489      composeEnumerationExtras("preference", element.getPreferenceElement(),
60490          new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
60491    }
60492    if (element.hasContainer()) {
60493      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
60494    }
60495    if (element.hasRequirementElement()) {
60496      composeStringCore("requirement", element.getRequirementElement(), false);
60497      composeStringExtras("requirement", element.getRequirementElement(), false);
60498    }
60499    if (element.hasRetentionTime()) {
60500      composeDuration("retentionTime", element.getRetentionTime());
60501    }
60502    if (element.hasRejectionCriterion()) {
60503      openArray("rejectionCriterion");
60504      for (CodeableConcept e : element.getRejectionCriterion())
60505        composeCodeableConcept(null, e);
60506      closeArray();
60507    }
60508    ;
60509    if (element.hasHandling()) {
60510      openArray("handling");
60511      for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling())
60512        composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(null, e);
60513      closeArray();
60514    }
60515    ;
60516  }
60517
60518  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name,
60519      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
60520    if (element != null) {
60521      open(name);
60522      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(element);
60523      close();
60524    }
60525  }
60526
60527  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(
60528      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
60529    composeBackbone(element);
60530    if (element.hasMaterial()) {
60531      composeCodeableConcept("material", element.getMaterial());
60532    }
60533    if (element.hasType()) {
60534      composeCodeableConcept("type", element.getType());
60535    }
60536    if (element.hasCap()) {
60537      composeCodeableConcept("cap", element.getCap());
60538    }
60539    if (element.hasDescriptionElement()) {
60540      composeStringCore("description", element.getDescriptionElement(), false);
60541      composeStringExtras("description", element.getDescriptionElement(), false);
60542    }
60543    if (element.hasCapacity()) {
60544      composeQuantity("capacity", element.getCapacity());
60545    }
60546    if (element.hasMinimumVolume()) {
60547      composeType("minimumVolume", element.getMinimumVolume());
60548    }
60549    if (element.hasAdditive()) {
60550      openArray("additive");
60551      for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive())
60552        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
60553      closeArray();
60554    }
60555    ;
60556    if (element.hasPreparationElement()) {
60557      composeStringCore("preparation", element.getPreparationElement(), false);
60558      composeStringExtras("preparation", element.getPreparationElement(), false);
60559    }
60560  }
60561
60562  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name,
60563      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
60564    if (element != null) {
60565      open(name);
60566      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(element);
60567      close();
60568    }
60569  }
60570
60571  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(
60572      SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
60573    composeBackbone(element);
60574    if (element.hasAdditive()) {
60575      composeType("additive", element.getAdditive());
60576    }
60577  }
60578
60579  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name,
60580      SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
60581    if (element != null) {
60582      open(name);
60583      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(element);
60584      close();
60585    }
60586  }
60587
60588  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(
60589      SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
60590    composeBackbone(element);
60591    if (element.hasTemperatureQualifier()) {
60592      composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
60593    }
60594    if (element.hasTemperatureRange()) {
60595      composeRange("temperatureRange", element.getTemperatureRange());
60596    }
60597    if (element.hasMaxDuration()) {
60598      composeDuration("maxDuration", element.getMaxDuration());
60599    }
60600    if (element.hasInstructionElement()) {
60601      composeStringCore("instruction", element.getInstructionElement(), false);
60602      composeStringExtras("instruction", element.getInstructionElement(), false);
60603    }
60604  }
60605
60606  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
60607    if (element != null) {
60608      prop("resourceType", name);
60609      composeStructureDefinitionInner(element);
60610    }
60611  }
60612
60613  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
60614    composeDomainResourceElements(element);
60615    if (element.hasUrlElement()) {
60616      composeUriCore("url", element.getUrlElement(), false);
60617      composeUriExtras("url", element.getUrlElement(), false);
60618    }
60619    if (element.hasIdentifier()) {
60620      openArray("identifier");
60621      for (Identifier e : element.getIdentifier())
60622        composeIdentifier(null, e);
60623      closeArray();
60624    }
60625    ;
60626    if (element.hasVersionElement()) {
60627      composeStringCore("version", element.getVersionElement(), false);
60628      composeStringExtras("version", element.getVersionElement(), false);
60629    }
60630    if (element.hasNameElement()) {
60631      composeStringCore("name", element.getNameElement(), false);
60632      composeStringExtras("name", element.getNameElement(), false);
60633    }
60634    if (element.hasTitleElement()) {
60635      composeStringCore("title", element.getTitleElement(), false);
60636      composeStringExtras("title", element.getTitleElement(), false);
60637    }
60638    if (element.hasStatusElement()) {
60639      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
60640          false);
60641      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
60642          false);
60643    }
60644    if (element.hasExperimentalElement()) {
60645      composeBooleanCore("experimental", element.getExperimentalElement(), false);
60646      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
60647    }
60648    if (element.hasDateElement()) {
60649      composeDateTimeCore("date", element.getDateElement(), false);
60650      composeDateTimeExtras("date", element.getDateElement(), false);
60651    }
60652    if (element.hasPublisherElement()) {
60653      composeStringCore("publisher", element.getPublisherElement(), false);
60654      composeStringExtras("publisher", element.getPublisherElement(), false);
60655    }
60656    if (element.hasContact()) {
60657      openArray("contact");
60658      for (ContactDetail e : element.getContact())
60659        composeContactDetail(null, e);
60660      closeArray();
60661    }
60662    ;
60663    if (element.hasDescriptionElement()) {
60664      composeMarkdownCore("description", element.getDescriptionElement(), false);
60665      composeMarkdownExtras("description", element.getDescriptionElement(), false);
60666    }
60667    if (element.hasUseContext()) {
60668      openArray("useContext");
60669      for (UsageContext e : element.getUseContext())
60670        composeUsageContext(null, e);
60671      closeArray();
60672    }
60673    ;
60674    if (element.hasJurisdiction()) {
60675      openArray("jurisdiction");
60676      for (CodeableConcept e : element.getJurisdiction())
60677        composeCodeableConcept(null, e);
60678      closeArray();
60679    }
60680    ;
60681    if (element.hasPurposeElement()) {
60682      composeMarkdownCore("purpose", element.getPurposeElement(), false);
60683      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
60684    }
60685    if (element.hasCopyrightElement()) {
60686      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
60687      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
60688    }
60689    if (element.hasKeyword()) {
60690      openArray("keyword");
60691      for (Coding e : element.getKeyword())
60692        composeCoding(null, e);
60693      closeArray();
60694    }
60695    ;
60696    if (element.hasFhirVersionElement()) {
60697      composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(),
60698          false);
60699      composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(),
60700          new Enumerations.FHIRVersionEnumFactory(), false);
60701    }
60702    if (element.hasMapping()) {
60703      openArray("mapping");
60704      for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping())
60705        composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
60706      closeArray();
60707    }
60708    ;
60709    if (element.hasKindElement()) {
60710      composeEnumerationCore("kind", element.getKindElement(),
60711          new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
60712      composeEnumerationExtras("kind", element.getKindElement(),
60713          new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
60714    }
60715    if (element.hasAbstractElement()) {
60716      composeBooleanCore("abstract", element.getAbstractElement(), false);
60717      composeBooleanExtras("abstract", element.getAbstractElement(), false);
60718    }
60719    if (element.hasContext()) {
60720      openArray("context");
60721      for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext())
60722        composeStructureDefinitionStructureDefinitionContextComponent(null, e);
60723      closeArray();
60724    }
60725    ;
60726    if (element.hasContextInvariant()) {
60727      openArray("contextInvariant");
60728      for (StringType e : element.getContextInvariant())
60729        composeStringCore(null, e, true);
60730      closeArray();
60731      if (anyHasExtras(element.getContextInvariant())) {
60732        openArray("_contextInvariant");
60733        for (StringType e : element.getContextInvariant())
60734          composeStringExtras(null, e, true);
60735        closeArray();
60736      }
60737    }
60738    ;
60739    if (element.hasTypeElement()) {
60740      composeUriCore("type", element.getTypeElement(), false);
60741      composeUriExtras("type", element.getTypeElement(), false);
60742    }
60743    if (element.hasBaseDefinitionElement()) {
60744      composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
60745      composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
60746    }
60747    if (element.hasDerivationElement()) {
60748      composeEnumerationCore("derivation", element.getDerivationElement(),
60749          new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
60750      composeEnumerationExtras("derivation", element.getDerivationElement(),
60751          new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
60752    }
60753    if (element.hasSnapshot()) {
60754      composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
60755    }
60756    if (element.hasDifferential()) {
60757      composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
60758    }
60759  }
60760
60761  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name,
60762      StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
60763    if (element != null) {
60764      open(name);
60765      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
60766      close();
60767    }
60768  }
60769
60770  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(
60771      StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
60772    composeBackbone(element);
60773    if (element.hasIdentityElement()) {
60774      composeIdCore("identity", element.getIdentityElement(), false);
60775      composeIdExtras("identity", element.getIdentityElement(), false);
60776    }
60777    if (element.hasUriElement()) {
60778      composeUriCore("uri", element.getUriElement(), false);
60779      composeUriExtras("uri", element.getUriElement(), false);
60780    }
60781    if (element.hasNameElement()) {
60782      composeStringCore("name", element.getNameElement(), false);
60783      composeStringExtras("name", element.getNameElement(), false);
60784    }
60785    if (element.hasCommentElement()) {
60786      composeStringCore("comment", element.getCommentElement(), false);
60787      composeStringExtras("comment", element.getCommentElement(), false);
60788    }
60789  }
60790
60791  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name,
60792      StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
60793    if (element != null) {
60794      open(name);
60795      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
60796      close();
60797    }
60798  }
60799
60800  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(
60801      StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
60802    composeBackbone(element);
60803    if (element.hasTypeElement()) {
60804      composeEnumerationCore("type", element.getTypeElement(),
60805          new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
60806      composeEnumerationExtras("type", element.getTypeElement(),
60807          new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
60808    }
60809    if (element.hasExpressionElement()) {
60810      composeStringCore("expression", element.getExpressionElement(), false);
60811      composeStringExtras("expression", element.getExpressionElement(), false);
60812    }
60813  }
60814
60815  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name,
60816      StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
60817    if (element != null) {
60818      open(name);
60819      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
60820      close();
60821    }
60822  }
60823
60824  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(
60825      StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
60826    composeBackbone(element);
60827    if (element.hasElement()) {
60828      openArray("element");
60829      for (ElementDefinition e : element.getElement())
60830        composeElementDefinition(null, e);
60831      closeArray();
60832    }
60833    ;
60834  }
60835
60836  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name,
60837      StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
60838    if (element != null) {
60839      open(name);
60840      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
60841      close();
60842    }
60843  }
60844
60845  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(
60846      StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
60847    composeBackbone(element);
60848    if (element.hasElement()) {
60849      openArray("element");
60850      for (ElementDefinition e : element.getElement())
60851        composeElementDefinition(null, e);
60852      closeArray();
60853    }
60854    ;
60855  }
60856
60857  protected void composeStructureMap(String name, StructureMap element) throws IOException {
60858    if (element != null) {
60859      prop("resourceType", name);
60860      composeStructureMapInner(element);
60861    }
60862  }
60863
60864  protected void composeStructureMapInner(StructureMap element) throws IOException {
60865    composeDomainResourceElements(element);
60866    if (element.hasUrlElement()) {
60867      composeUriCore("url", element.getUrlElement(), false);
60868      composeUriExtras("url", element.getUrlElement(), false);
60869    }
60870    if (element.hasIdentifier()) {
60871      openArray("identifier");
60872      for (Identifier e : element.getIdentifier())
60873        composeIdentifier(null, e);
60874      closeArray();
60875    }
60876    ;
60877    if (element.hasVersionElement()) {
60878      composeStringCore("version", element.getVersionElement(), false);
60879      composeStringExtras("version", element.getVersionElement(), false);
60880    }
60881    if (element.hasNameElement()) {
60882      composeStringCore("name", element.getNameElement(), false);
60883      composeStringExtras("name", element.getNameElement(), false);
60884    }
60885    if (element.hasTitleElement()) {
60886      composeStringCore("title", element.getTitleElement(), false);
60887      composeStringExtras("title", element.getTitleElement(), false);
60888    }
60889    if (element.hasStatusElement()) {
60890      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
60891          false);
60892      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
60893          false);
60894    }
60895    if (element.hasExperimentalElement()) {
60896      composeBooleanCore("experimental", element.getExperimentalElement(), false);
60897      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
60898    }
60899    if (element.hasDateElement()) {
60900      composeDateTimeCore("date", element.getDateElement(), false);
60901      composeDateTimeExtras("date", element.getDateElement(), false);
60902    }
60903    if (element.hasPublisherElement()) {
60904      composeStringCore("publisher", element.getPublisherElement(), false);
60905      composeStringExtras("publisher", element.getPublisherElement(), false);
60906    }
60907    if (element.hasContact()) {
60908      openArray("contact");
60909      for (ContactDetail e : element.getContact())
60910        composeContactDetail(null, e);
60911      closeArray();
60912    }
60913    ;
60914    if (element.hasDescriptionElement()) {
60915      composeMarkdownCore("description", element.getDescriptionElement(), false);
60916      composeMarkdownExtras("description", element.getDescriptionElement(), false);
60917    }
60918    if (element.hasUseContext()) {
60919      openArray("useContext");
60920      for (UsageContext e : element.getUseContext())
60921        composeUsageContext(null, e);
60922      closeArray();
60923    }
60924    ;
60925    if (element.hasJurisdiction()) {
60926      openArray("jurisdiction");
60927      for (CodeableConcept e : element.getJurisdiction())
60928        composeCodeableConcept(null, e);
60929      closeArray();
60930    }
60931    ;
60932    if (element.hasPurposeElement()) {
60933      composeMarkdownCore("purpose", element.getPurposeElement(), false);
60934      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
60935    }
60936    if (element.hasCopyrightElement()) {
60937      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
60938      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
60939    }
60940    if (element.hasStructure()) {
60941      openArray("structure");
60942      for (StructureMap.StructureMapStructureComponent e : element.getStructure())
60943        composeStructureMapStructureMapStructureComponent(null, e);
60944      closeArray();
60945    }
60946    ;
60947    if (element.hasImport()) {
60948      openArray("import");
60949      for (CanonicalType e : element.getImport())
60950        composeCanonicalCore(null, e, true);
60951      closeArray();
60952      if (anyHasExtras(element.getImport())) {
60953        openArray("_import");
60954        for (CanonicalType e : element.getImport())
60955          composeCanonicalExtras(null, e, true);
60956        closeArray();
60957      }
60958    }
60959    ;
60960    if (element.hasGroup()) {
60961      openArray("group");
60962      for (StructureMap.StructureMapGroupComponent e : element.getGroup())
60963        composeStructureMapStructureMapGroupComponent(null, e);
60964      closeArray();
60965    }
60966    ;
60967  }
60968
60969  protected void composeStructureMapStructureMapStructureComponent(String name,
60970      StructureMap.StructureMapStructureComponent element) throws IOException {
60971    if (element != null) {
60972      open(name);
60973      composeStructureMapStructureMapStructureComponentInner(element);
60974      close();
60975    }
60976  }
60977
60978  protected void composeStructureMapStructureMapStructureComponentInner(
60979      StructureMap.StructureMapStructureComponent element) throws IOException {
60980    composeBackbone(element);
60981    if (element.hasUrlElement()) {
60982      composeCanonicalCore("url", element.getUrlElement(), false);
60983      composeCanonicalExtras("url", element.getUrlElement(), false);
60984    }
60985    if (element.hasModeElement()) {
60986      composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(),
60987          false);
60988      composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(),
60989          false);
60990    }
60991    if (element.hasAliasElement()) {
60992      composeStringCore("alias", element.getAliasElement(), false);
60993      composeStringExtras("alias", element.getAliasElement(), false);
60994    }
60995    if (element.hasDocumentationElement()) {
60996      composeStringCore("documentation", element.getDocumentationElement(), false);
60997      composeStringExtras("documentation", element.getDocumentationElement(), false);
60998    }
60999  }
61000
61001  protected void composeStructureMapStructureMapGroupComponent(String name,
61002      StructureMap.StructureMapGroupComponent element) throws IOException {
61003    if (element != null) {
61004      open(name);
61005      composeStructureMapStructureMapGroupComponentInner(element);
61006      close();
61007    }
61008  }
61009
61010  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element)
61011      throws IOException {
61012    composeBackbone(element);
61013    if (element.hasNameElement()) {
61014      composeIdCore("name", element.getNameElement(), false);
61015      composeIdExtras("name", element.getNameElement(), false);
61016    }
61017    if (element.hasExtendsElement()) {
61018      composeIdCore("extends", element.getExtendsElement(), false);
61019      composeIdExtras("extends", element.getExtendsElement(), false);
61020    }
61021    if (element.hasTypeModeElement()) {
61022      composeEnumerationCore("typeMode", element.getTypeModeElement(),
61023          new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
61024      composeEnumerationExtras("typeMode", element.getTypeModeElement(),
61025          new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
61026    }
61027    if (element.hasDocumentationElement()) {
61028      composeStringCore("documentation", element.getDocumentationElement(), false);
61029      composeStringExtras("documentation", element.getDocumentationElement(), false);
61030    }
61031    if (element.hasInput()) {
61032      openArray("input");
61033      for (StructureMap.StructureMapGroupInputComponent e : element.getInput())
61034        composeStructureMapStructureMapGroupInputComponent(null, e);
61035      closeArray();
61036    }
61037    ;
61038    if (element.hasRule()) {
61039      openArray("rule");
61040      for (StructureMap.StructureMapGroupRuleComponent e : element.getRule())
61041        composeStructureMapStructureMapGroupRuleComponent(null, e);
61042      closeArray();
61043    }
61044    ;
61045  }
61046
61047  protected void composeStructureMapStructureMapGroupInputComponent(String name,
61048      StructureMap.StructureMapGroupInputComponent element) throws IOException {
61049    if (element != null) {
61050      open(name);
61051      composeStructureMapStructureMapGroupInputComponentInner(element);
61052      close();
61053    }
61054  }
61055
61056  protected void composeStructureMapStructureMapGroupInputComponentInner(
61057      StructureMap.StructureMapGroupInputComponent element) throws IOException {
61058    composeBackbone(element);
61059    if (element.hasNameElement()) {
61060      composeIdCore("name", element.getNameElement(), false);
61061      composeIdExtras("name", element.getNameElement(), false);
61062    }
61063    if (element.hasTypeElement()) {
61064      composeStringCore("type", element.getTypeElement(), false);
61065      composeStringExtras("type", element.getTypeElement(), false);
61066    }
61067    if (element.hasModeElement()) {
61068      composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(),
61069          false);
61070      composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(),
61071          false);
61072    }
61073    if (element.hasDocumentationElement()) {
61074      composeStringCore("documentation", element.getDocumentationElement(), false);
61075      composeStringExtras("documentation", element.getDocumentationElement(), false);
61076    }
61077  }
61078
61079  protected void composeStructureMapStructureMapGroupRuleComponent(String name,
61080      StructureMap.StructureMapGroupRuleComponent element) throws IOException {
61081    if (element != null) {
61082      open(name);
61083      composeStructureMapStructureMapGroupRuleComponentInner(element);
61084      close();
61085    }
61086  }
61087
61088  protected void composeStructureMapStructureMapGroupRuleComponentInner(
61089      StructureMap.StructureMapGroupRuleComponent element) throws IOException {
61090    composeBackbone(element);
61091    if (element.hasNameElement()) {
61092      composeIdCore("name", element.getNameElement(), false);
61093      composeIdExtras("name", element.getNameElement(), false);
61094    }
61095    if (element.hasSource()) {
61096      openArray("source");
61097      for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource())
61098        composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
61099      closeArray();
61100    }
61101    ;
61102    if (element.hasTarget()) {
61103      openArray("target");
61104      for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget())
61105        composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
61106      closeArray();
61107    }
61108    ;
61109    if (element.hasRule()) {
61110      openArray("rule");
61111      for (StructureMap.StructureMapGroupRuleComponent e : element.getRule())
61112        composeStructureMapStructureMapGroupRuleComponent(null, e);
61113      closeArray();
61114    }
61115    ;
61116    if (element.hasDependent()) {
61117      openArray("dependent");
61118      for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent())
61119        composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
61120      closeArray();
61121    }
61122    ;
61123    if (element.hasDocumentationElement()) {
61124      composeStringCore("documentation", element.getDocumentationElement(), false);
61125      composeStringExtras("documentation", element.getDocumentationElement(), false);
61126    }
61127  }
61128
61129  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name,
61130      StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
61131    if (element != null) {
61132      open(name);
61133      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
61134      close();
61135    }
61136  }
61137
61138  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(
61139      StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
61140    composeBackbone(element);
61141    if (element.hasContextElement()) {
61142      composeIdCore("context", element.getContextElement(), false);
61143      composeIdExtras("context", element.getContextElement(), false);
61144    }
61145    if (element.hasMinElement()) {
61146      composeIntegerCore("min", element.getMinElement(), false);
61147      composeIntegerExtras("min", element.getMinElement(), false);
61148    }
61149    if (element.hasMaxElement()) {
61150      composeStringCore("max", element.getMaxElement(), false);
61151      composeStringExtras("max", element.getMaxElement(), false);
61152    }
61153    if (element.hasTypeElement()) {
61154      composeStringCore("type", element.getTypeElement(), false);
61155      composeStringExtras("type", element.getTypeElement(), false);
61156    }
61157    if (element.hasDefaultValue()) {
61158      composeType("defaultValue", element.getDefaultValue());
61159    }
61160    if (element.hasElementElement()) {
61161      composeStringCore("element", element.getElementElement(), false);
61162      composeStringExtras("element", element.getElementElement(), false);
61163    }
61164    if (element.hasListModeElement()) {
61165      composeEnumerationCore("listMode", element.getListModeElement(),
61166          new StructureMap.StructureMapSourceListModeEnumFactory(), false);
61167      composeEnumerationExtras("listMode", element.getListModeElement(),
61168          new StructureMap.StructureMapSourceListModeEnumFactory(), false);
61169    }
61170    if (element.hasVariableElement()) {
61171      composeIdCore("variable", element.getVariableElement(), false);
61172      composeIdExtras("variable", element.getVariableElement(), false);
61173    }
61174    if (element.hasConditionElement()) {
61175      composeStringCore("condition", element.getConditionElement(), false);
61176      composeStringExtras("condition", element.getConditionElement(), false);
61177    }
61178    if (element.hasCheckElement()) {
61179      composeStringCore("check", element.getCheckElement(), false);
61180      composeStringExtras("check", element.getCheckElement(), false);
61181    }
61182    if (element.hasLogMessageElement()) {
61183      composeStringCore("logMessage", element.getLogMessageElement(), false);
61184      composeStringExtras("logMessage", element.getLogMessageElement(), false);
61185    }
61186  }
61187
61188  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name,
61189      StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
61190    if (element != null) {
61191      open(name);
61192      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
61193      close();
61194    }
61195  }
61196
61197  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(
61198      StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
61199    composeBackbone(element);
61200    if (element.hasContextElement()) {
61201      composeIdCore("context", element.getContextElement(), false);
61202      composeIdExtras("context", element.getContextElement(), false);
61203    }
61204    if (element.hasContextTypeElement()) {
61205      composeEnumerationCore("contextType", element.getContextTypeElement(),
61206          new StructureMap.StructureMapContextTypeEnumFactory(), false);
61207      composeEnumerationExtras("contextType", element.getContextTypeElement(),
61208          new StructureMap.StructureMapContextTypeEnumFactory(), false);
61209    }
61210    if (element.hasElementElement()) {
61211      composeStringCore("element", element.getElementElement(), false);
61212      composeStringExtras("element", element.getElementElement(), false);
61213    }
61214    if (element.hasVariableElement()) {
61215      composeIdCore("variable", element.getVariableElement(), false);
61216      composeIdExtras("variable", element.getVariableElement(), false);
61217    }
61218    if (element.hasListMode()) {
61219      openArray("listMode");
61220      for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode())
61221        composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
61222      closeArray();
61223      if (anyHasExtras(element.getListMode())) {
61224        openArray("_listMode");
61225        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode())
61226          composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
61227        closeArray();
61228      }
61229    }
61230    ;
61231    if (element.hasListRuleIdElement()) {
61232      composeIdCore("listRuleId", element.getListRuleIdElement(), false);
61233      composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
61234    }
61235    if (element.hasTransformElement()) {
61236      composeEnumerationCore("transform", element.getTransformElement(),
61237          new StructureMap.StructureMapTransformEnumFactory(), false);
61238      composeEnumerationExtras("transform", element.getTransformElement(),
61239          new StructureMap.StructureMapTransformEnumFactory(), false);
61240    }
61241    if (element.hasParameter()) {
61242      openArray("parameter");
61243      for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter())
61244        composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
61245      closeArray();
61246    }
61247    ;
61248  }
61249
61250  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name,
61251      StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
61252    if (element != null) {
61253      open(name);
61254      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
61255      close();
61256    }
61257  }
61258
61259  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(
61260      StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
61261    composeBackbone(element);
61262    if (element.hasValue()) {
61263      composeType("value", element.getValue());
61264    }
61265  }
61266
61267  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name,
61268      StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
61269    if (element != null) {
61270      open(name);
61271      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
61272      close();
61273    }
61274  }
61275
61276  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(
61277      StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
61278    composeBackbone(element);
61279    if (element.hasNameElement()) {
61280      composeIdCore("name", element.getNameElement(), false);
61281      composeIdExtras("name", element.getNameElement(), false);
61282    }
61283    if (element.hasVariable()) {
61284      openArray("variable");
61285      for (StringType e : element.getVariable())
61286        composeStringCore(null, e, true);
61287      closeArray();
61288      if (anyHasExtras(element.getVariable())) {
61289        openArray("_variable");
61290        for (StringType e : element.getVariable())
61291          composeStringExtras(null, e, true);
61292        closeArray();
61293      }
61294    }
61295    ;
61296  }
61297
61298  protected void composeSubscription(String name, Subscription element) throws IOException {
61299    if (element != null) {
61300      prop("resourceType", name);
61301      composeSubscriptionInner(element);
61302    }
61303  }
61304
61305  protected void composeSubscriptionInner(Subscription element) throws IOException {
61306    composeDomainResourceElements(element);
61307    if (element.hasStatusElement()) {
61308      composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(),
61309          false);
61310      composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(),
61311          false);
61312    }
61313    if (element.hasContact()) {
61314      openArray("contact");
61315      for (ContactPoint e : element.getContact())
61316        composeContactPoint(null, e);
61317      closeArray();
61318    }
61319    ;
61320    if (element.hasEndElement()) {
61321      composeInstantCore("end", element.getEndElement(), false);
61322      composeInstantExtras("end", element.getEndElement(), false);
61323    }
61324    if (element.hasReasonElement()) {
61325      composeStringCore("reason", element.getReasonElement(), false);
61326      composeStringExtras("reason", element.getReasonElement(), false);
61327    }
61328    if (element.hasCriteriaElement()) {
61329      composeStringCore("criteria", element.getCriteriaElement(), false);
61330      composeStringExtras("criteria", element.getCriteriaElement(), false);
61331    }
61332    if (element.hasErrorElement()) {
61333      composeStringCore("error", element.getErrorElement(), false);
61334      composeStringExtras("error", element.getErrorElement(), false);
61335    }
61336    if (element.hasChannel()) {
61337      composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
61338    }
61339  }
61340
61341  protected void composeSubscriptionSubscriptionChannelComponent(String name,
61342      Subscription.SubscriptionChannelComponent element) throws IOException {
61343    if (element != null) {
61344      open(name);
61345      composeSubscriptionSubscriptionChannelComponentInner(element);
61346      close();
61347    }
61348  }
61349
61350  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element)
61351      throws IOException {
61352    composeBackbone(element);
61353    if (element.hasTypeElement()) {
61354      composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(),
61355          false);
61356      composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(),
61357          false);
61358    }
61359    if (element.hasEndpointElement()) {
61360      composeUrlCore("endpoint", element.getEndpointElement(), false);
61361      composeUrlExtras("endpoint", element.getEndpointElement(), false);
61362    }
61363    if (element.hasPayloadElement()) {
61364      composeCodeCore("payload", element.getPayloadElement(), false);
61365      composeCodeExtras("payload", element.getPayloadElement(), false);
61366    }
61367    if (element.hasHeader()) {
61368      openArray("header");
61369      for (StringType e : element.getHeader())
61370        composeStringCore(null, e, true);
61371      closeArray();
61372      if (anyHasExtras(element.getHeader())) {
61373        openArray("_header");
61374        for (StringType e : element.getHeader())
61375          composeStringExtras(null, e, true);
61376        closeArray();
61377      }
61378    }
61379    ;
61380  }
61381
61382  protected void composeSubstance(String name, Substance element) throws IOException {
61383    if (element != null) {
61384      prop("resourceType", name);
61385      composeSubstanceInner(element);
61386    }
61387  }
61388
61389  protected void composeSubstanceInner(Substance element) throws IOException {
61390    composeDomainResourceElements(element);
61391    if (element.hasIdentifier()) {
61392      openArray("identifier");
61393      for (Identifier e : element.getIdentifier())
61394        composeIdentifier(null, e);
61395      closeArray();
61396    }
61397    ;
61398    if (element.hasStatusElement()) {
61399      composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(),
61400          false);
61401      composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(),
61402          false);
61403    }
61404    if (element.hasCategory()) {
61405      openArray("category");
61406      for (CodeableConcept e : element.getCategory())
61407        composeCodeableConcept(null, e);
61408      closeArray();
61409    }
61410    ;
61411    if (element.hasCode()) {
61412      composeCodeableConcept("code", element.getCode());
61413    }
61414    if (element.hasDescriptionElement()) {
61415      composeStringCore("description", element.getDescriptionElement(), false);
61416      composeStringExtras("description", element.getDescriptionElement(), false);
61417    }
61418    if (element.hasInstance()) {
61419      openArray("instance");
61420      for (Substance.SubstanceInstanceComponent e : element.getInstance())
61421        composeSubstanceSubstanceInstanceComponent(null, e);
61422      closeArray();
61423    }
61424    ;
61425    if (element.hasIngredient()) {
61426      openArray("ingredient");
61427      for (Substance.SubstanceIngredientComponent e : element.getIngredient())
61428        composeSubstanceSubstanceIngredientComponent(null, e);
61429      closeArray();
61430    }
61431    ;
61432  }
61433
61434  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element)
61435      throws IOException {
61436    if (element != null) {
61437      open(name);
61438      composeSubstanceSubstanceInstanceComponentInner(element);
61439      close();
61440    }
61441  }
61442
61443  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element)
61444      throws IOException {
61445    composeBackbone(element);
61446    if (element.hasIdentifier()) {
61447      composeIdentifier("identifier", element.getIdentifier());
61448    }
61449    if (element.hasExpiryElement()) {
61450      composeDateTimeCore("expiry", element.getExpiryElement(), false);
61451      composeDateTimeExtras("expiry", element.getExpiryElement(), false);
61452    }
61453    if (element.hasQuantity()) {
61454      composeQuantity("quantity", element.getQuantity());
61455    }
61456  }
61457
61458  protected void composeSubstanceSubstanceIngredientComponent(String name,
61459      Substance.SubstanceIngredientComponent element) throws IOException {
61460    if (element != null) {
61461      open(name);
61462      composeSubstanceSubstanceIngredientComponentInner(element);
61463      close();
61464    }
61465  }
61466
61467  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element)
61468      throws IOException {
61469    composeBackbone(element);
61470    if (element.hasQuantity()) {
61471      composeRatio("quantity", element.getQuantity());
61472    }
61473    if (element.hasSubstance()) {
61474      composeType("substance", element.getSubstance());
61475    }
61476  }
61477
61478  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
61479    if (element != null) {
61480      prop("resourceType", name);
61481      composeSubstanceNucleicAcidInner(element);
61482    }
61483  }
61484
61485  protected void composeSubstanceNucleicAcidInner(SubstanceNucleicAcid element) throws IOException {
61486    composeDomainResourceElements(element);
61487    if (element.hasSequenceType()) {
61488      composeCodeableConcept("sequenceType", element.getSequenceType());
61489    }
61490    if (element.hasNumberOfSubunitsElement()) {
61491      composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
61492      composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
61493    }
61494    if (element.hasAreaOfHybridisationElement()) {
61495      composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
61496      composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
61497    }
61498    if (element.hasOligoNucleotideType()) {
61499      composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
61500    }
61501    if (element.hasSubunit()) {
61502      openArray("subunit");
61503      for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit())
61504        composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(null, e);
61505      closeArray();
61506    }
61507    ;
61508  }
61509
61510  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(String name,
61511      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
61512    if (element != null) {
61513      open(name);
61514      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(element);
61515      close();
61516    }
61517  }
61518
61519  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(
61520      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
61521    composeBackbone(element);
61522    if (element.hasSubunitElement()) {
61523      composeIntegerCore("subunit", element.getSubunitElement(), false);
61524      composeIntegerExtras("subunit", element.getSubunitElement(), false);
61525    }
61526    if (element.hasSequenceElement()) {
61527      composeStringCore("sequence", element.getSequenceElement(), false);
61528      composeStringExtras("sequence", element.getSequenceElement(), false);
61529    }
61530    if (element.hasLengthElement()) {
61531      composeIntegerCore("length", element.getLengthElement(), false);
61532      composeIntegerExtras("length", element.getLengthElement(), false);
61533    }
61534    if (element.hasSequenceAttachment()) {
61535      composeAttachment("sequenceAttachment", element.getSequenceAttachment());
61536    }
61537    if (element.hasFivePrime()) {
61538      composeCodeableConcept("fivePrime", element.getFivePrime());
61539    }
61540    if (element.hasThreePrime()) {
61541      composeCodeableConcept("threePrime", element.getThreePrime());
61542    }
61543    if (element.hasLinkage()) {
61544      openArray("linkage");
61545      for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage())
61546        composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(null, e);
61547      closeArray();
61548    }
61549    ;
61550    if (element.hasSugar()) {
61551      openArray("sugar");
61552      for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar())
61553        composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(null, e);
61554      closeArray();
61555    }
61556    ;
61557  }
61558
61559  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(String name,
61560      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
61561    if (element != null) {
61562      open(name);
61563      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(element);
61564      close();
61565    }
61566  }
61567
61568  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(
61569      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
61570    composeBackbone(element);
61571    if (element.hasConnectivityElement()) {
61572      composeStringCore("connectivity", element.getConnectivityElement(), false);
61573      composeStringExtras("connectivity", element.getConnectivityElement(), false);
61574    }
61575    if (element.hasIdentifier()) {
61576      composeIdentifier("identifier", element.getIdentifier());
61577    }
61578    if (element.hasNameElement()) {
61579      composeStringCore("name", element.getNameElement(), false);
61580      composeStringExtras("name", element.getNameElement(), false);
61581    }
61582    if (element.hasResidueSiteElement()) {
61583      composeStringCore("residueSite", element.getResidueSiteElement(), false);
61584      composeStringExtras("residueSite", element.getResidueSiteElement(), false);
61585    }
61586  }
61587
61588  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(String name,
61589      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
61590    if (element != null) {
61591      open(name);
61592      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(element);
61593      close();
61594    }
61595  }
61596
61597  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(
61598      SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
61599    composeBackbone(element);
61600    if (element.hasIdentifier()) {
61601      composeIdentifier("identifier", element.getIdentifier());
61602    }
61603    if (element.hasNameElement()) {
61604      composeStringCore("name", element.getNameElement(), false);
61605      composeStringExtras("name", element.getNameElement(), false);
61606    }
61607    if (element.hasResidueSiteElement()) {
61608      composeStringCore("residueSite", element.getResidueSiteElement(), false);
61609      composeStringExtras("residueSite", element.getResidueSiteElement(), false);
61610    }
61611  }
61612
61613  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
61614    if (element != null) {
61615      prop("resourceType", name);
61616      composeSubstancePolymerInner(element);
61617    }
61618  }
61619
61620  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
61621    composeDomainResourceElements(element);
61622    if (element.hasClass_()) {
61623      composeCodeableConcept("class", element.getClass_());
61624    }
61625    if (element.hasGeometry()) {
61626      composeCodeableConcept("geometry", element.getGeometry());
61627    }
61628    if (element.hasCopolymerConnectivity()) {
61629      openArray("copolymerConnectivity");
61630      for (CodeableConcept e : element.getCopolymerConnectivity())
61631        composeCodeableConcept(null, e);
61632      closeArray();
61633    }
61634    ;
61635    if (element.hasModification()) {
61636      openArray("modification");
61637      for (StringType e : element.getModification())
61638        composeStringCore(null, e, true);
61639      closeArray();
61640      if (anyHasExtras(element.getModification())) {
61641        openArray("_modification");
61642        for (StringType e : element.getModification())
61643          composeStringExtras(null, e, true);
61644        closeArray();
61645      }
61646    }
61647    ;
61648    if (element.hasMonomerSet()) {
61649      openArray("monomerSet");
61650      for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet())
61651        composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
61652      closeArray();
61653    }
61654    ;
61655    if (element.hasRepeat()) {
61656      openArray("repeat");
61657      for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat())
61658        composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
61659      closeArray();
61660    }
61661    ;
61662  }
61663
61664  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name,
61665      SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
61666    if (element != null) {
61667      open(name);
61668      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
61669      close();
61670    }
61671  }
61672
61673  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(
61674      SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
61675    composeBackbone(element);
61676    if (element.hasRatioType()) {
61677      composeCodeableConcept("ratioType", element.getRatioType());
61678    }
61679    if (element.hasStartingMaterial()) {
61680      openArray("startingMaterial");
61681      for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial())
61682        composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
61683      closeArray();
61684    }
61685    ;
61686  }
61687
61688  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name,
61689      SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
61690    if (element != null) {
61691      open(name);
61692      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
61693      close();
61694    }
61695  }
61696
61697  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(
61698      SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
61699    composeBackbone(element);
61700    if (element.hasMaterial()) {
61701      composeCodeableConcept("material", element.getMaterial());
61702    }
61703    if (element.hasType()) {
61704      composeCodeableConcept("type", element.getType());
61705    }
61706    if (element.hasIsDefiningElement()) {
61707      composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
61708      composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
61709    }
61710    if (element.hasAmount()) {
61711      composeSubstanceAmount("amount", element.getAmount());
61712    }
61713  }
61714
61715  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name,
61716      SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
61717    if (element != null) {
61718      open(name);
61719      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
61720      close();
61721    }
61722  }
61723
61724  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(
61725      SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
61726    composeBackbone(element);
61727    if (element.hasNumberOfUnitsElement()) {
61728      composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
61729      composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
61730    }
61731    if (element.hasAverageMolecularFormulaElement()) {
61732      composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
61733      composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
61734    }
61735    if (element.hasRepeatUnitAmountType()) {
61736      composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
61737    }
61738    if (element.hasRepeatUnit()) {
61739      openArray("repeatUnit");
61740      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit())
61741        composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
61742      closeArray();
61743    }
61744    ;
61745  }
61746
61747  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name,
61748      SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
61749    if (element != null) {
61750      open(name);
61751      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
61752      close();
61753    }
61754  }
61755
61756  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(
61757      SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
61758    composeBackbone(element);
61759    if (element.hasOrientationOfPolymerisation()) {
61760      composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
61761    }
61762    if (element.hasRepeatUnitElement()) {
61763      composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
61764      composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
61765    }
61766    if (element.hasAmount()) {
61767      composeSubstanceAmount("amount", element.getAmount());
61768    }
61769    if (element.hasDegreeOfPolymerisation()) {
61770      openArray("degreeOfPolymerisation");
61771      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element
61772          .getDegreeOfPolymerisation())
61773        composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
61774      closeArray();
61775    }
61776    ;
61777    if (element.hasStructuralRepresentation()) {
61778      openArray("structuralRepresentation");
61779      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element
61780          .getStructuralRepresentation())
61781        composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
61782      closeArray();
61783    }
61784    ;
61785  }
61786
61787  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name,
61788      SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
61789    if (element != null) {
61790      open(name);
61791      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
61792      close();
61793    }
61794  }
61795
61796  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(
61797      SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
61798    composeBackbone(element);
61799    if (element.hasDegree()) {
61800      composeCodeableConcept("degree", element.getDegree());
61801    }
61802    if (element.hasAmount()) {
61803      composeSubstanceAmount("amount", element.getAmount());
61804    }
61805  }
61806
61807  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name,
61808      SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
61809    if (element != null) {
61810      open(name);
61811      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
61812      close();
61813    }
61814  }
61815
61816  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(
61817      SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
61818    composeBackbone(element);
61819    if (element.hasType()) {
61820      composeCodeableConcept("type", element.getType());
61821    }
61822    if (element.hasRepresentationElement()) {
61823      composeStringCore("representation", element.getRepresentationElement(), false);
61824      composeStringExtras("representation", element.getRepresentationElement(), false);
61825    }
61826    if (element.hasAttachment()) {
61827      composeAttachment("attachment", element.getAttachment());
61828    }
61829  }
61830
61831  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
61832    if (element != null) {
61833      prop("resourceType", name);
61834      composeSubstanceProteinInner(element);
61835    }
61836  }
61837
61838  protected void composeSubstanceProteinInner(SubstanceProtein element) throws IOException {
61839    composeDomainResourceElements(element);
61840    if (element.hasSequenceType()) {
61841      composeCodeableConcept("sequenceType", element.getSequenceType());
61842    }
61843    if (element.hasNumberOfSubunitsElement()) {
61844      composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
61845      composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
61846    }
61847    if (element.hasDisulfideLinkage()) {
61848      openArray("disulfideLinkage");
61849      for (StringType e : element.getDisulfideLinkage())
61850        composeStringCore(null, e, true);
61851      closeArray();
61852      if (anyHasExtras(element.getDisulfideLinkage())) {
61853        openArray("_disulfideLinkage");
61854        for (StringType e : element.getDisulfideLinkage())
61855          composeStringExtras(null, e, true);
61856        closeArray();
61857      }
61858    }
61859    ;
61860    if (element.hasSubunit()) {
61861      openArray("subunit");
61862      for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit())
61863        composeSubstanceProteinSubstanceProteinSubunitComponent(null, e);
61864      closeArray();
61865    }
61866    ;
61867  }
61868
61869  protected void composeSubstanceProteinSubstanceProteinSubunitComponent(String name,
61870      SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
61871    if (element != null) {
61872      open(name);
61873      composeSubstanceProteinSubstanceProteinSubunitComponentInner(element);
61874      close();
61875    }
61876  }
61877
61878  protected void composeSubstanceProteinSubstanceProteinSubunitComponentInner(
61879      SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
61880    composeBackbone(element);
61881    if (element.hasSubunitElement()) {
61882      composeIntegerCore("subunit", element.getSubunitElement(), false);
61883      composeIntegerExtras("subunit", element.getSubunitElement(), false);
61884    }
61885    if (element.hasSequenceElement()) {
61886      composeStringCore("sequence", element.getSequenceElement(), false);
61887      composeStringExtras("sequence", element.getSequenceElement(), false);
61888    }
61889    if (element.hasLengthElement()) {
61890      composeIntegerCore("length", element.getLengthElement(), false);
61891      composeIntegerExtras("length", element.getLengthElement(), false);
61892    }
61893    if (element.hasSequenceAttachment()) {
61894      composeAttachment("sequenceAttachment", element.getSequenceAttachment());
61895    }
61896    if (element.hasNTerminalModificationId()) {
61897      composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
61898    }
61899    if (element.hasNTerminalModificationElement()) {
61900      composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
61901      composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
61902    }
61903    if (element.hasCTerminalModificationId()) {
61904      composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
61905    }
61906    if (element.hasCTerminalModificationElement()) {
61907      composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
61908      composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
61909    }
61910  }
61911
61912  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element)
61913      throws IOException {
61914    if (element != null) {
61915      prop("resourceType", name);
61916      composeSubstanceReferenceInformationInner(element);
61917    }
61918  }
61919
61920  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
61921    composeDomainResourceElements(element);
61922    if (element.hasCommentElement()) {
61923      composeStringCore("comment", element.getCommentElement(), false);
61924      composeStringExtras("comment", element.getCommentElement(), false);
61925    }
61926    if (element.hasGene()) {
61927      openArray("gene");
61928      for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene())
61929        composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
61930      closeArray();
61931    }
61932    ;
61933    if (element.hasGeneElement()) {
61934      openArray("geneElement");
61935      for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement())
61936        composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
61937      closeArray();
61938    }
61939    ;
61940    if (element.hasClassification()) {
61941      openArray("classification");
61942      for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element
61943          .getClassification())
61944        composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
61945      closeArray();
61946    }
61947    ;
61948    if (element.hasTarget()) {
61949      openArray("target");
61950      for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget())
61951        composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
61952      closeArray();
61953    }
61954    ;
61955  }
61956
61957  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name,
61958      SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
61959    if (element != null) {
61960      open(name);
61961      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
61962      close();
61963    }
61964  }
61965
61966  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(
61967      SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
61968    composeBackbone(element);
61969    if (element.hasGeneSequenceOrigin()) {
61970      composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
61971    }
61972    if (element.hasGene()) {
61973      composeCodeableConcept("gene", element.getGene());
61974    }
61975    if (element.hasSource()) {
61976      openArray("source");
61977      for (Reference e : element.getSource())
61978        composeReference(null, e);
61979      closeArray();
61980    }
61981    ;
61982  }
61983
61984  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name,
61985      SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
61986    if (element != null) {
61987      open(name);
61988      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
61989      close();
61990    }
61991  }
61992
61993  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(
61994      SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
61995    composeBackbone(element);
61996    if (element.hasType()) {
61997      composeCodeableConcept("type", element.getType());
61998    }
61999    if (element.hasElement()) {
62000      composeIdentifier("element", element.getElement());
62001    }
62002    if (element.hasSource()) {
62003      openArray("source");
62004      for (Reference e : element.getSource())
62005        composeReference(null, e);
62006      closeArray();
62007    }
62008    ;
62009  }
62010
62011  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name,
62012      SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
62013    if (element != null) {
62014      open(name);
62015      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
62016      close();
62017    }
62018  }
62019
62020  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(
62021      SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
62022    composeBackbone(element);
62023    if (element.hasDomain()) {
62024      composeCodeableConcept("domain", element.getDomain());
62025    }
62026    if (element.hasClassification()) {
62027      composeCodeableConcept("classification", element.getClassification());
62028    }
62029    if (element.hasSubtype()) {
62030      openArray("subtype");
62031      for (CodeableConcept e : element.getSubtype())
62032        composeCodeableConcept(null, e);
62033      closeArray();
62034    }
62035    ;
62036    if (element.hasSource()) {
62037      openArray("source");
62038      for (Reference e : element.getSource())
62039        composeReference(null, e);
62040      closeArray();
62041    }
62042    ;
62043  }
62044
62045  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name,
62046      SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
62047    if (element != null) {
62048      open(name);
62049      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
62050      close();
62051    }
62052  }
62053
62054  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(
62055      SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
62056    composeBackbone(element);
62057    if (element.hasTarget()) {
62058      composeIdentifier("target", element.getTarget());
62059    }
62060    if (element.hasType()) {
62061      composeCodeableConcept("type", element.getType());
62062    }
62063    if (element.hasInteraction()) {
62064      composeCodeableConcept("interaction", element.getInteraction());
62065    }
62066    if (element.hasOrganism()) {
62067      composeCodeableConcept("organism", element.getOrganism());
62068    }
62069    if (element.hasOrganismType()) {
62070      composeCodeableConcept("organismType", element.getOrganismType());
62071    }
62072    if (element.hasAmount()) {
62073      composeType("amount", element.getAmount());
62074    }
62075    if (element.hasAmountType()) {
62076      composeCodeableConcept("amountType", element.getAmountType());
62077    }
62078    if (element.hasSource()) {
62079      openArray("source");
62080      for (Reference e : element.getSource())
62081        composeReference(null, e);
62082      closeArray();
62083    }
62084    ;
62085  }
62086
62087  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
62088    if (element != null) {
62089      prop("resourceType", name);
62090      composeSubstanceSourceMaterialInner(element);
62091    }
62092  }
62093
62094  protected void composeSubstanceSourceMaterialInner(SubstanceSourceMaterial element) throws IOException {
62095    composeDomainResourceElements(element);
62096    if (element.hasSourceMaterialClass()) {
62097      composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
62098    }
62099    if (element.hasSourceMaterialType()) {
62100      composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
62101    }
62102    if (element.hasSourceMaterialState()) {
62103      composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
62104    }
62105    if (element.hasOrganismId()) {
62106      composeIdentifier("organismId", element.getOrganismId());
62107    }
62108    if (element.hasOrganismNameElement()) {
62109      composeStringCore("organismName", element.getOrganismNameElement(), false);
62110      composeStringExtras("organismName", element.getOrganismNameElement(), false);
62111    }
62112    if (element.hasParentSubstanceId()) {
62113      openArray("parentSubstanceId");
62114      for (Identifier e : element.getParentSubstanceId())
62115        composeIdentifier(null, e);
62116      closeArray();
62117    }
62118    ;
62119    if (element.hasParentSubstanceName()) {
62120      openArray("parentSubstanceName");
62121      for (StringType e : element.getParentSubstanceName())
62122        composeStringCore(null, e, true);
62123      closeArray();
62124      if (anyHasExtras(element.getParentSubstanceName())) {
62125        openArray("_parentSubstanceName");
62126        for (StringType e : element.getParentSubstanceName())
62127          composeStringExtras(null, e, true);
62128        closeArray();
62129      }
62130    }
62131    ;
62132    if (element.hasCountryOfOrigin()) {
62133      openArray("countryOfOrigin");
62134      for (CodeableConcept e : element.getCountryOfOrigin())
62135        composeCodeableConcept(null, e);
62136      closeArray();
62137    }
62138    ;
62139    if (element.hasGeographicalLocation()) {
62140      openArray("geographicalLocation");
62141      for (StringType e : element.getGeographicalLocation())
62142        composeStringCore(null, e, true);
62143      closeArray();
62144      if (anyHasExtras(element.getGeographicalLocation())) {
62145        openArray("_geographicalLocation");
62146        for (StringType e : element.getGeographicalLocation())
62147          composeStringExtras(null, e, true);
62148        closeArray();
62149      }
62150    }
62151    ;
62152    if (element.hasDevelopmentStage()) {
62153      composeCodeableConcept("developmentStage", element.getDevelopmentStage());
62154    }
62155    if (element.hasFractionDescription()) {
62156      openArray("fractionDescription");
62157      for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element
62158          .getFractionDescription())
62159        composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(null, e);
62160      closeArray();
62161    }
62162    ;
62163    if (element.hasOrganism()) {
62164      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
62165    }
62166    if (element.hasPartDescription()) {
62167      openArray("partDescription");
62168      for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription())
62169        composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(null, e);
62170      closeArray();
62171    }
62172    ;
62173  }
62174
62175  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(String name,
62176      SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
62177    if (element != null) {
62178      open(name);
62179      composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(element);
62180      close();
62181    }
62182  }
62183
62184  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(
62185      SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
62186    composeBackbone(element);
62187    if (element.hasFractionElement()) {
62188      composeStringCore("fraction", element.getFractionElement(), false);
62189      composeStringExtras("fraction", element.getFractionElement(), false);
62190    }
62191    if (element.hasMaterialType()) {
62192      composeCodeableConcept("materialType", element.getMaterialType());
62193    }
62194  }
62195
62196  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(String name,
62197      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
62198    if (element != null) {
62199      open(name);
62200      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(element);
62201      close();
62202    }
62203  }
62204
62205  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(
62206      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
62207    composeBackbone(element);
62208    if (element.hasFamily()) {
62209      composeCodeableConcept("family", element.getFamily());
62210    }
62211    if (element.hasGenus()) {
62212      composeCodeableConcept("genus", element.getGenus());
62213    }
62214    if (element.hasSpecies()) {
62215      composeCodeableConcept("species", element.getSpecies());
62216    }
62217    if (element.hasIntraspecificType()) {
62218      composeCodeableConcept("intraspecificType", element.getIntraspecificType());
62219    }
62220    if (element.hasIntraspecificDescriptionElement()) {
62221      composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
62222      composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
62223    }
62224    if (element.hasAuthor()) {
62225      openArray("author");
62226      for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor())
62227        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(null, e);
62228      closeArray();
62229    }
62230    ;
62231    if (element.hasHybrid()) {
62232      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
62233    }
62234    if (element.hasOrganismGeneral()) {
62235      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral",
62236          element.getOrganismGeneral());
62237    }
62238  }
62239
62240  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(String name,
62241      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
62242    if (element != null) {
62243      open(name);
62244      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(element);
62245      close();
62246    }
62247  }
62248
62249  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(
62250      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
62251    composeBackbone(element);
62252    if (element.hasAuthorType()) {
62253      composeCodeableConcept("authorType", element.getAuthorType());
62254    }
62255    if (element.hasAuthorDescriptionElement()) {
62256      composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
62257      composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
62258    }
62259  }
62260
62261  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(String name,
62262      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
62263    if (element != null) {
62264      open(name);
62265      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(element);
62266      close();
62267    }
62268  }
62269
62270  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(
62271      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
62272    composeBackbone(element);
62273    if (element.hasMaternalOrganismIdElement()) {
62274      composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
62275      composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
62276    }
62277    if (element.hasMaternalOrganismNameElement()) {
62278      composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
62279      composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
62280    }
62281    if (element.hasPaternalOrganismIdElement()) {
62282      composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
62283      composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
62284    }
62285    if (element.hasPaternalOrganismNameElement()) {
62286      composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
62287      composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
62288    }
62289    if (element.hasHybridType()) {
62290      composeCodeableConcept("hybridType", element.getHybridType());
62291    }
62292  }
62293
62294  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name,
62295      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
62296    if (element != null) {
62297      open(name);
62298      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(element);
62299      close();
62300    }
62301  }
62302
62303  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(
62304      SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
62305    composeBackbone(element);
62306    if (element.hasKingdom()) {
62307      composeCodeableConcept("kingdom", element.getKingdom());
62308    }
62309    if (element.hasPhylum()) {
62310      composeCodeableConcept("phylum", element.getPhylum());
62311    }
62312    if (element.hasClass_()) {
62313      composeCodeableConcept("class", element.getClass_());
62314    }
62315    if (element.hasOrder()) {
62316      composeCodeableConcept("order", element.getOrder());
62317    }
62318  }
62319
62320  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(String name,
62321      SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
62322    if (element != null) {
62323      open(name);
62324      composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(element);
62325      close();
62326    }
62327  }
62328
62329  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(
62330      SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
62331    composeBackbone(element);
62332    if (element.hasPart()) {
62333      composeCodeableConcept("part", element.getPart());
62334    }
62335    if (element.hasPartLocation()) {
62336      composeCodeableConcept("partLocation", element.getPartLocation());
62337    }
62338  }
62339
62340  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
62341    if (element != null) {
62342      prop("resourceType", name);
62343      composeSubstanceSpecificationInner(element);
62344    }
62345  }
62346
62347  protected void composeSubstanceSpecificationInner(SubstanceSpecification element) throws IOException {
62348    composeDomainResourceElements(element);
62349    if (element.hasIdentifier()) {
62350      composeIdentifier("identifier", element.getIdentifier());
62351    }
62352    if (element.hasType()) {
62353      composeCodeableConcept("type", element.getType());
62354    }
62355    if (element.hasStatus()) {
62356      composeCodeableConcept("status", element.getStatus());
62357    }
62358    if (element.hasDomain()) {
62359      composeCodeableConcept("domain", element.getDomain());
62360    }
62361    if (element.hasDescriptionElement()) {
62362      composeStringCore("description", element.getDescriptionElement(), false);
62363      composeStringExtras("description", element.getDescriptionElement(), false);
62364    }
62365    if (element.hasSource()) {
62366      openArray("source");
62367      for (Reference e : element.getSource())
62368        composeReference(null, e);
62369      closeArray();
62370    }
62371    ;
62372    if (element.hasCommentElement()) {
62373      composeStringCore("comment", element.getCommentElement(), false);
62374      composeStringExtras("comment", element.getCommentElement(), false);
62375    }
62376    if (element.hasMoiety()) {
62377      openArray("moiety");
62378      for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety())
62379        composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(null, e);
62380      closeArray();
62381    }
62382    ;
62383    if (element.hasProperty()) {
62384      openArray("property");
62385      for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty())
62386        composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(null, e);
62387      closeArray();
62388    }
62389    ;
62390    if (element.hasReferenceInformation()) {
62391      composeReference("referenceInformation", element.getReferenceInformation());
62392    }
62393    if (element.hasStructure()) {
62394      composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
62395    }
62396    if (element.hasCode()) {
62397      openArray("code");
62398      for (SubstanceSpecification.SubstanceSpecificationCodeComponent e : element.getCode())
62399        composeSubstanceSpecificationSubstanceSpecificationCodeComponent(null, e);
62400      closeArray();
62401    }
62402    ;
62403    if (element.hasName()) {
62404      openArray("name");
62405      for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getName())
62406        composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
62407      closeArray();
62408    }
62409    ;
62410    if (element.hasMolecularWeight()) {
62411      openArray("molecularWeight");
62412      for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element
62413          .getMolecularWeight())
62414        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(null, e);
62415      closeArray();
62416    }
62417    ;
62418    if (element.hasRelationship()) {
62419      openArray("relationship");
62420      for (SubstanceSpecification.SubstanceSpecificationRelationshipComponent e : element.getRelationship())
62421        composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(null, e);
62422      closeArray();
62423    }
62424    ;
62425    if (element.hasNucleicAcid()) {
62426      composeReference("nucleicAcid", element.getNucleicAcid());
62427    }
62428    if (element.hasPolymer()) {
62429      composeReference("polymer", element.getPolymer());
62430    }
62431    if (element.hasProtein()) {
62432      composeReference("protein", element.getProtein());
62433    }
62434    if (element.hasSourceMaterial()) {
62435      composeReference("sourceMaterial", element.getSourceMaterial());
62436    }
62437  }
62438
62439  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name,
62440      SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
62441    if (element != null) {
62442      open(name);
62443      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(element);
62444      close();
62445    }
62446  }
62447
62448  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(
62449      SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
62450    composeBackbone(element);
62451    if (element.hasRole()) {
62452      composeCodeableConcept("role", element.getRole());
62453    }
62454    if (element.hasIdentifier()) {
62455      composeIdentifier("identifier", element.getIdentifier());
62456    }
62457    if (element.hasNameElement()) {
62458      composeStringCore("name", element.getNameElement(), false);
62459      composeStringExtras("name", element.getNameElement(), false);
62460    }
62461    if (element.hasStereochemistry()) {
62462      composeCodeableConcept("stereochemistry", element.getStereochemistry());
62463    }
62464    if (element.hasOpticalActivity()) {
62465      composeCodeableConcept("opticalActivity", element.getOpticalActivity());
62466    }
62467    if (element.hasMolecularFormulaElement()) {
62468      composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
62469      composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
62470    }
62471    if (element.hasAmount()) {
62472      composeType("amount", element.getAmount());
62473    }
62474  }
62475
62476  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name,
62477      SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
62478    if (element != null) {
62479      open(name);
62480      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(element);
62481      close();
62482    }
62483  }
62484
62485  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(
62486      SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
62487    composeBackbone(element);
62488    if (element.hasCategory()) {
62489      composeCodeableConcept("category", element.getCategory());
62490    }
62491    if (element.hasCode()) {
62492      composeCodeableConcept("code", element.getCode());
62493    }
62494    if (element.hasParametersElement()) {
62495      composeStringCore("parameters", element.getParametersElement(), false);
62496      composeStringExtras("parameters", element.getParametersElement(), false);
62497    }
62498    if (element.hasDefiningSubstance()) {
62499      composeType("definingSubstance", element.getDefiningSubstance());
62500    }
62501    if (element.hasAmount()) {
62502      composeType("amount", element.getAmount());
62503    }
62504  }
62505
62506  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name,
62507      SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
62508    if (element != null) {
62509      open(name);
62510      composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(element);
62511      close();
62512    }
62513  }
62514
62515  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(
62516      SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
62517    composeBackbone(element);
62518    if (element.hasStereochemistry()) {
62519      composeCodeableConcept("stereochemistry", element.getStereochemistry());
62520    }
62521    if (element.hasOpticalActivity()) {
62522      composeCodeableConcept("opticalActivity", element.getOpticalActivity());
62523    }
62524    if (element.hasMolecularFormulaElement()) {
62525      composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
62526      composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
62527    }
62528    if (element.hasMolecularFormulaByMoietyElement()) {
62529      composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
62530      composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
62531    }
62532    if (element.hasIsotope()) {
62533      openArray("isotope");
62534      for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope())
62535        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(null, e);
62536      closeArray();
62537    }
62538    ;
62539    if (element.hasMolecularWeight()) {
62540      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight",
62541          element.getMolecularWeight());
62542    }
62543    if (element.hasSource()) {
62544      openArray("source");
62545      for (Reference e : element.getSource())
62546        composeReference(null, e);
62547      closeArray();
62548    }
62549    ;
62550    if (element.hasRepresentation()) {
62551      openArray("representation");
62552      for (SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent e : element
62553          .getRepresentation())
62554        composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(null, e);
62555      closeArray();
62556    }
62557    ;
62558  }
62559
62560  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name,
62561      SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
62562    if (element != null) {
62563      open(name);
62564      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(element);
62565      close();
62566    }
62567  }
62568
62569  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(
62570      SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
62571    composeBackbone(element);
62572    if (element.hasIdentifier()) {
62573      composeIdentifier("identifier", element.getIdentifier());
62574    }
62575    if (element.hasName()) {
62576      composeCodeableConcept("name", element.getName());
62577    }
62578    if (element.hasSubstitution()) {
62579      composeCodeableConcept("substitution", element.getSubstitution());
62580    }
62581    if (element.hasHalfLife()) {
62582      composeQuantity("halfLife", element.getHalfLife());
62583    }
62584    if (element.hasMolecularWeight()) {
62585      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight",
62586          element.getMolecularWeight());
62587    }
62588  }
62589
62590  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(
62591      String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element)
62592      throws IOException {
62593    if (element != null) {
62594      open(name);
62595      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(element);
62596      close();
62597    }
62598  }
62599
62600  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(
62601      SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element)
62602      throws IOException {
62603    composeBackbone(element);
62604    if (element.hasMethod()) {
62605      composeCodeableConcept("method", element.getMethod());
62606    }
62607    if (element.hasType()) {
62608      composeCodeableConcept("type", element.getType());
62609    }
62610    if (element.hasAmount()) {
62611      composeQuantity("amount", element.getAmount());
62612    }
62613  }
62614
62615  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(String name,
62616      SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
62617    if (element != null) {
62618      open(name);
62619      composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(element);
62620      close();
62621    }
62622  }
62623
62624  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(
62625      SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
62626    composeBackbone(element);
62627    if (element.hasType()) {
62628      composeCodeableConcept("type", element.getType());
62629    }
62630    if (element.hasRepresentationElement()) {
62631      composeStringCore("representation", element.getRepresentationElement(), false);
62632      composeStringExtras("representation", element.getRepresentationElement(), false);
62633    }
62634    if (element.hasAttachment()) {
62635      composeAttachment("attachment", element.getAttachment());
62636    }
62637  }
62638
62639  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponent(String name,
62640      SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
62641    if (element != null) {
62642      open(name);
62643      composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(element);
62644      close();
62645    }
62646  }
62647
62648  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(
62649      SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
62650    composeBackbone(element);
62651    if (element.hasCode()) {
62652      composeCodeableConcept("code", element.getCode());
62653    }
62654    if (element.hasStatus()) {
62655      composeCodeableConcept("status", element.getStatus());
62656    }
62657    if (element.hasStatusDateElement()) {
62658      composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
62659      composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
62660    }
62661    if (element.hasCommentElement()) {
62662      composeStringCore("comment", element.getCommentElement(), false);
62663      composeStringExtras("comment", element.getCommentElement(), false);
62664    }
62665    if (element.hasSource()) {
62666      openArray("source");
62667      for (Reference e : element.getSource())
62668        composeReference(null, e);
62669      closeArray();
62670    }
62671    ;
62672  }
62673
62674  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponent(String name,
62675      SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
62676    if (element != null) {
62677      open(name);
62678      composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(element);
62679      close();
62680    }
62681  }
62682
62683  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(
62684      SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
62685    composeBackbone(element);
62686    if (element.hasNameElement()) {
62687      composeStringCore("name", element.getNameElement(), false);
62688      composeStringExtras("name", element.getNameElement(), false);
62689    }
62690    if (element.hasType()) {
62691      composeCodeableConcept("type", element.getType());
62692    }
62693    if (element.hasStatus()) {
62694      composeCodeableConcept("status", element.getStatus());
62695    }
62696    if (element.hasPreferredElement()) {
62697      composeBooleanCore("preferred", element.getPreferredElement(), false);
62698      composeBooleanExtras("preferred", element.getPreferredElement(), false);
62699    }
62700    if (element.hasLanguage()) {
62701      openArray("language");
62702      for (CodeableConcept e : element.getLanguage())
62703        composeCodeableConcept(null, e);
62704      closeArray();
62705    }
62706    ;
62707    if (element.hasDomain()) {
62708      openArray("domain");
62709      for (CodeableConcept e : element.getDomain())
62710        composeCodeableConcept(null, e);
62711      closeArray();
62712    }
62713    ;
62714    if (element.hasJurisdiction()) {
62715      openArray("jurisdiction");
62716      for (CodeableConcept e : element.getJurisdiction())
62717        composeCodeableConcept(null, e);
62718      closeArray();
62719    }
62720    ;
62721    if (element.hasSynonym()) {
62722      openArray("synonym");
62723      for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getSynonym())
62724        composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
62725      closeArray();
62726    }
62727    ;
62728    if (element.hasTranslation()) {
62729      openArray("translation");
62730      for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getTranslation())
62731        composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
62732      closeArray();
62733    }
62734    ;
62735    if (element.hasOfficial()) {
62736      openArray("official");
62737      for (SubstanceSpecification.SubstanceSpecificationNameOfficialComponent e : element.getOfficial())
62738        composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(null, e);
62739      closeArray();
62740    }
62741    ;
62742    if (element.hasSource()) {
62743      openArray("source");
62744      for (Reference e : element.getSource())
62745        composeReference(null, e);
62746      closeArray();
62747    }
62748    ;
62749  }
62750
62751  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(String name,
62752      SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
62753    if (element != null) {
62754      open(name);
62755      composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(element);
62756      close();
62757    }
62758  }
62759
62760  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(
62761      SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
62762    composeBackbone(element);
62763    if (element.hasAuthority()) {
62764      composeCodeableConcept("authority", element.getAuthority());
62765    }
62766    if (element.hasStatus()) {
62767      composeCodeableConcept("status", element.getStatus());
62768    }
62769    if (element.hasDateElement()) {
62770      composeDateTimeCore("date", element.getDateElement(), false);
62771      composeDateTimeExtras("date", element.getDateElement(), false);
62772    }
62773  }
62774
62775  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(String name,
62776      SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
62777    if (element != null) {
62778      open(name);
62779      composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(element);
62780      close();
62781    }
62782  }
62783
62784  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(
62785      SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
62786    composeBackbone(element);
62787    if (element.hasSubstance()) {
62788      composeType("substance", element.getSubstance());
62789    }
62790    if (element.hasRelationship()) {
62791      composeCodeableConcept("relationship", element.getRelationship());
62792    }
62793    if (element.hasIsDefiningElement()) {
62794      composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
62795      composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
62796    }
62797    if (element.hasAmount()) {
62798      composeType("amount", element.getAmount());
62799    }
62800    if (element.hasAmountRatioLowLimit()) {
62801      composeRatio("amountRatioLowLimit", element.getAmountRatioLowLimit());
62802    }
62803    if (element.hasAmountType()) {
62804      composeCodeableConcept("amountType", element.getAmountType());
62805    }
62806    if (element.hasSource()) {
62807      openArray("source");
62808      for (Reference e : element.getSource())
62809        composeReference(null, e);
62810      closeArray();
62811    }
62812    ;
62813  }
62814
62815  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
62816    if (element != null) {
62817      prop("resourceType", name);
62818      composeSupplyDeliveryInner(element);
62819    }
62820  }
62821
62822  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
62823    composeDomainResourceElements(element);
62824    if (element.hasIdentifier()) {
62825      openArray("identifier");
62826      for (Identifier e : element.getIdentifier())
62827        composeIdentifier(null, e);
62828      closeArray();
62829    }
62830    ;
62831    if (element.hasBasedOn()) {
62832      openArray("basedOn");
62833      for (Reference e : element.getBasedOn())
62834        composeReference(null, e);
62835      closeArray();
62836    }
62837    ;
62838    if (element.hasPartOf()) {
62839      openArray("partOf");
62840      for (Reference e : element.getPartOf())
62841        composeReference(null, e);
62842      closeArray();
62843    }
62844    ;
62845    if (element.hasStatusElement()) {
62846      composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(),
62847          false);
62848      composeEnumerationExtras("status", element.getStatusElement(),
62849          new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
62850    }
62851    if (element.hasPatient()) {
62852      composeReference("patient", element.getPatient());
62853    }
62854    if (element.hasType()) {
62855      composeCodeableConcept("type", element.getType());
62856    }
62857    if (element.hasSuppliedItem()) {
62858      composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
62859    }
62860    if (element.hasOccurrence()) {
62861      composeType("occurrence", element.getOccurrence());
62862    }
62863    if (element.hasSupplier()) {
62864      composeReference("supplier", element.getSupplier());
62865    }
62866    if (element.hasDestination()) {
62867      composeReference("destination", element.getDestination());
62868    }
62869    if (element.hasReceiver()) {
62870      openArray("receiver");
62871      for (Reference e : element.getReceiver())
62872        composeReference(null, e);
62873      closeArray();
62874    }
62875    ;
62876  }
62877
62878  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name,
62879      SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
62880    if (element != null) {
62881      open(name);
62882      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
62883      close();
62884    }
62885  }
62886
62887  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(
62888      SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
62889    composeBackbone(element);
62890    if (element.hasQuantity()) {
62891      composeQuantity("quantity", element.getQuantity());
62892    }
62893    if (element.hasItem()) {
62894      composeType("item", element.getItem());
62895    }
62896  }
62897
62898  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
62899    if (element != null) {
62900      prop("resourceType", name);
62901      composeSupplyRequestInner(element);
62902    }
62903  }
62904
62905  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
62906    composeDomainResourceElements(element);
62907    if (element.hasIdentifier()) {
62908      openArray("identifier");
62909      for (Identifier e : element.getIdentifier())
62910        composeIdentifier(null, e);
62911      closeArray();
62912    }
62913    ;
62914    if (element.hasStatusElement()) {
62915      composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(),
62916          false);
62917      composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(),
62918          false);
62919    }
62920    if (element.hasCategory()) {
62921      composeCodeableConcept("category", element.getCategory());
62922    }
62923    if (element.hasPriorityElement()) {
62924      composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(),
62925          false);
62926      composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(),
62927          false);
62928    }
62929    if (element.hasItem()) {
62930      composeType("item", element.getItem());
62931    }
62932    if (element.hasQuantity()) {
62933      composeQuantity("quantity", element.getQuantity());
62934    }
62935    if (element.hasParameter()) {
62936      openArray("parameter");
62937      for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter())
62938        composeSupplyRequestSupplyRequestParameterComponent(null, e);
62939      closeArray();
62940    }
62941    ;
62942    if (element.hasOccurrence()) {
62943      composeType("occurrence", element.getOccurrence());
62944    }
62945    if (element.hasAuthoredOnElement()) {
62946      composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
62947      composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
62948    }
62949    if (element.hasRequester()) {
62950      composeReference("requester", element.getRequester());
62951    }
62952    if (element.hasSupplier()) {
62953      openArray("supplier");
62954      for (Reference e : element.getSupplier())
62955        composeReference(null, e);
62956      closeArray();
62957    }
62958    ;
62959    if (element.hasReasonCode()) {
62960      openArray("reasonCode");
62961      for (CodeableConcept e : element.getReasonCode())
62962        composeCodeableConcept(null, e);
62963      closeArray();
62964    }
62965    ;
62966    if (element.hasReasonReference()) {
62967      openArray("reasonReference");
62968      for (Reference e : element.getReasonReference())
62969        composeReference(null, e);
62970      closeArray();
62971    }
62972    ;
62973    if (element.hasDeliverFrom()) {
62974      composeReference("deliverFrom", element.getDeliverFrom());
62975    }
62976    if (element.hasDeliverTo()) {
62977      composeReference("deliverTo", element.getDeliverTo());
62978    }
62979  }
62980
62981  protected void composeSupplyRequestSupplyRequestParameterComponent(String name,
62982      SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
62983    if (element != null) {
62984      open(name);
62985      composeSupplyRequestSupplyRequestParameterComponentInner(element);
62986      close();
62987    }
62988  }
62989
62990  protected void composeSupplyRequestSupplyRequestParameterComponentInner(
62991      SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
62992    composeBackbone(element);
62993    if (element.hasCode()) {
62994      composeCodeableConcept("code", element.getCode());
62995    }
62996    if (element.hasValue()) {
62997      composeType("value", element.getValue());
62998    }
62999  }
63000
63001  protected void composeTask(String name, Task element) throws IOException {
63002    if (element != null) {
63003      prop("resourceType", name);
63004      composeTaskInner(element);
63005    }
63006  }
63007
63008  protected void composeTaskInner(Task element) throws IOException {
63009    composeDomainResourceElements(element);
63010    if (element.hasIdentifier()) {
63011      openArray("identifier");
63012      for (Identifier e : element.getIdentifier())
63013        composeIdentifier(null, e);
63014      closeArray();
63015    }
63016    ;
63017    if (element.hasInstantiatesCanonicalElement()) {
63018      composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
63019      composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
63020    }
63021    if (element.hasInstantiatesUriElement()) {
63022      composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
63023      composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
63024    }
63025    if (element.hasBasedOn()) {
63026      openArray("basedOn");
63027      for (Reference e : element.getBasedOn())
63028        composeReference(null, e);
63029      closeArray();
63030    }
63031    ;
63032    if (element.hasGroupIdentifier()) {
63033      composeIdentifier("groupIdentifier", element.getGroupIdentifier());
63034    }
63035    if (element.hasPartOf()) {
63036      openArray("partOf");
63037      for (Reference e : element.getPartOf())
63038        composeReference(null, e);
63039      closeArray();
63040    }
63041    ;
63042    if (element.hasStatusElement()) {
63043      composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
63044      composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
63045    }
63046    if (element.hasStatusReason()) {
63047      composeCodeableConcept("statusReason", element.getStatusReason());
63048    }
63049    if (element.hasBusinessStatus()) {
63050      composeCodeableConcept("businessStatus", element.getBusinessStatus());
63051    }
63052    if (element.hasIntentElement()) {
63053      composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
63054      composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
63055    }
63056    if (element.hasPriorityElement()) {
63057      composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
63058      composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
63059    }
63060    if (element.hasCode()) {
63061      composeCodeableConcept("code", element.getCode());
63062    }
63063    if (element.hasDescriptionElement()) {
63064      composeStringCore("description", element.getDescriptionElement(), false);
63065      composeStringExtras("description", element.getDescriptionElement(), false);
63066    }
63067    if (element.hasFocus()) {
63068      composeReference("focus", element.getFocus());
63069    }
63070    if (element.hasFor()) {
63071      composeReference("for", element.getFor());
63072    }
63073    if (element.hasEncounter()) {
63074      composeReference("encounter", element.getEncounter());
63075    }
63076    if (element.hasExecutionPeriod()) {
63077      composePeriod("executionPeriod", element.getExecutionPeriod());
63078    }
63079    if (element.hasAuthoredOnElement()) {
63080      composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
63081      composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
63082    }
63083    if (element.hasLastModifiedElement()) {
63084      composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
63085      composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
63086    }
63087    if (element.hasRequester()) {
63088      composeReference("requester", element.getRequester());
63089    }
63090    if (element.hasPerformerType()) {
63091      openArray("performerType");
63092      for (CodeableConcept e : element.getPerformerType())
63093        composeCodeableConcept(null, e);
63094      closeArray();
63095    }
63096    ;
63097    if (element.hasOwner()) {
63098      composeReference("owner", element.getOwner());
63099    }
63100    if (element.hasLocation()) {
63101      composeReference("location", element.getLocation());
63102    }
63103    if (element.hasReasonCode()) {
63104      composeCodeableConcept("reasonCode", element.getReasonCode());
63105    }
63106    if (element.hasReasonReference()) {
63107      composeReference("reasonReference", element.getReasonReference());
63108    }
63109    if (element.hasInsurance()) {
63110      openArray("insurance");
63111      for (Reference e : element.getInsurance())
63112        composeReference(null, e);
63113      closeArray();
63114    }
63115    ;
63116    if (element.hasNote()) {
63117      openArray("note");
63118      for (Annotation e : element.getNote())
63119        composeAnnotation(null, e);
63120      closeArray();
63121    }
63122    ;
63123    if (element.hasRelevantHistory()) {
63124      openArray("relevantHistory");
63125      for (Reference e : element.getRelevantHistory())
63126        composeReference(null, e);
63127      closeArray();
63128    }
63129    ;
63130    if (element.hasRestriction()) {
63131      composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
63132    }
63133    if (element.hasInput()) {
63134      openArray("input");
63135      for (Task.ParameterComponent e : element.getInput())
63136        composeTaskParameterComponent(null, e);
63137      closeArray();
63138    }
63139    ;
63140    if (element.hasOutput()) {
63141      openArray("output");
63142      for (Task.TaskOutputComponent e : element.getOutput())
63143        composeTaskTaskOutputComponent(null, e);
63144      closeArray();
63145    }
63146    ;
63147  }
63148
63149  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element)
63150      throws IOException {
63151    if (element != null) {
63152      open(name);
63153      composeTaskTaskRestrictionComponentInner(element);
63154      close();
63155    }
63156  }
63157
63158  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
63159    composeBackbone(element);
63160    if (element.hasRepetitionsElement()) {
63161      composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
63162      composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
63163    }
63164    if (element.hasPeriod()) {
63165      composePeriod("period", element.getPeriod());
63166    }
63167    if (element.hasRecipient()) {
63168      openArray("recipient");
63169      for (Reference e : element.getRecipient())
63170        composeReference(null, e);
63171      closeArray();
63172    }
63173    ;
63174  }
63175
63176  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
63177    if (element != null) {
63178      open(name);
63179      composeTaskParameterComponentInner(element);
63180      close();
63181    }
63182  }
63183
63184  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
63185    composeBackbone(element);
63186    if (element.hasType()) {
63187      composeCodeableConcept("type", element.getType());
63188    }
63189    if (element.hasValue()) {
63190      composeType("value", element.getValue());
63191    }
63192  }
63193
63194  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
63195    if (element != null) {
63196      open(name);
63197      composeTaskTaskOutputComponentInner(element);
63198      close();
63199    }
63200  }
63201
63202  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
63203    composeBackbone(element);
63204    if (element.hasType()) {
63205      composeCodeableConcept("type", element.getType());
63206    }
63207    if (element.hasValue()) {
63208      composeType("value", element.getValue());
63209    }
63210  }
63211
63212  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
63213    if (element != null) {
63214      prop("resourceType", name);
63215      composeTerminologyCapabilitiesInner(element);
63216    }
63217  }
63218
63219  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
63220    composeDomainResourceElements(element);
63221    if (element.hasUrlElement()) {
63222      composeUriCore("url", element.getUrlElement(), false);
63223      composeUriExtras("url", element.getUrlElement(), false);
63224    }
63225    if (element.hasVersionElement()) {
63226      composeStringCore("version", element.getVersionElement(), false);
63227      composeStringExtras("version", element.getVersionElement(), false);
63228    }
63229    if (element.hasNameElement()) {
63230      composeStringCore("name", element.getNameElement(), false);
63231      composeStringExtras("name", element.getNameElement(), false);
63232    }
63233    if (element.hasTitleElement()) {
63234      composeStringCore("title", element.getTitleElement(), false);
63235      composeStringExtras("title", element.getTitleElement(), false);
63236    }
63237    if (element.hasStatusElement()) {
63238      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
63239          false);
63240      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
63241          false);
63242    }
63243    if (element.hasExperimentalElement()) {
63244      composeBooleanCore("experimental", element.getExperimentalElement(), false);
63245      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
63246    }
63247    if (element.hasDateElement()) {
63248      composeDateTimeCore("date", element.getDateElement(), false);
63249      composeDateTimeExtras("date", element.getDateElement(), false);
63250    }
63251    if (element.hasPublisherElement()) {
63252      composeStringCore("publisher", element.getPublisherElement(), false);
63253      composeStringExtras("publisher", element.getPublisherElement(), false);
63254    }
63255    if (element.hasContact()) {
63256      openArray("contact");
63257      for (ContactDetail e : element.getContact())
63258        composeContactDetail(null, e);
63259      closeArray();
63260    }
63261    ;
63262    if (element.hasDescriptionElement()) {
63263      composeMarkdownCore("description", element.getDescriptionElement(), false);
63264      composeMarkdownExtras("description", element.getDescriptionElement(), false);
63265    }
63266    if (element.hasUseContext()) {
63267      openArray("useContext");
63268      for (UsageContext e : element.getUseContext())
63269        composeUsageContext(null, e);
63270      closeArray();
63271    }
63272    ;
63273    if (element.hasJurisdiction()) {
63274      openArray("jurisdiction");
63275      for (CodeableConcept e : element.getJurisdiction())
63276        composeCodeableConcept(null, e);
63277      closeArray();
63278    }
63279    ;
63280    if (element.hasPurposeElement()) {
63281      composeMarkdownCore("purpose", element.getPurposeElement(), false);
63282      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
63283    }
63284    if (element.hasCopyrightElement()) {
63285      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
63286      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
63287    }
63288    if (element.hasKindElement()) {
63289      composeEnumerationCore("kind", element.getKindElement(),
63290          new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
63291      composeEnumerationExtras("kind", element.getKindElement(),
63292          new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
63293    }
63294    if (element.hasSoftware()) {
63295      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
63296    }
63297    if (element.hasImplementation()) {
63298      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation",
63299          element.getImplementation());
63300    }
63301    if (element.hasLockedDateElement()) {
63302      composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
63303      composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
63304    }
63305    if (element.hasCodeSystem()) {
63306      openArray("codeSystem");
63307      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem())
63308        composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
63309      closeArray();
63310    }
63311    ;
63312    if (element.hasExpansion()) {
63313      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
63314    }
63315    if (element.hasCodeSearchElement()) {
63316      composeEnumerationCore("codeSearch", element.getCodeSearchElement(),
63317          new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
63318      composeEnumerationExtras("codeSearch", element.getCodeSearchElement(),
63319          new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
63320    }
63321    if (element.hasValidateCode()) {
63322      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode",
63323          element.getValidateCode());
63324    }
63325    if (element.hasTranslation()) {
63326      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation",
63327          element.getTranslation());
63328    }
63329    if (element.hasClosure()) {
63330      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
63331    }
63332  }
63333
63334  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name,
63335      TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
63336    if (element != null) {
63337      open(name);
63338      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(element);
63339      close();
63340    }
63341  }
63342
63343  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(
63344      TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
63345    composeBackbone(element);
63346    if (element.hasNameElement()) {
63347      composeStringCore("name", element.getNameElement(), false);
63348      composeStringExtras("name", element.getNameElement(), false);
63349    }
63350    if (element.hasVersionElement()) {
63351      composeStringCore("version", element.getVersionElement(), false);
63352      composeStringExtras("version", element.getVersionElement(), false);
63353    }
63354  }
63355
63356  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name,
63357      TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
63358    if (element != null) {
63359      open(name);
63360      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(element);
63361      close();
63362    }
63363  }
63364
63365  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(
63366      TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
63367    composeBackbone(element);
63368    if (element.hasDescriptionElement()) {
63369      composeStringCore("description", element.getDescriptionElement(), false);
63370      composeStringExtras("description", element.getDescriptionElement(), false);
63371    }
63372    if (element.hasUrlElement()) {
63373      composeUrlCore("url", element.getUrlElement(), false);
63374      composeUrlExtras("url", element.getUrlElement(), false);
63375    }
63376  }
63377
63378  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name,
63379      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
63380    if (element != null) {
63381      open(name);
63382      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
63383      close();
63384    }
63385  }
63386
63387  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(
63388      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
63389    composeBackbone(element);
63390    if (element.hasUriElement()) {
63391      composeCanonicalCore("uri", element.getUriElement(), false);
63392      composeCanonicalExtras("uri", element.getUriElement(), false);
63393    }
63394    if (element.hasVersion()) {
63395      openArray("version");
63396      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion())
63397        composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
63398      closeArray();
63399    }
63400    ;
63401    if (element.hasSubsumptionElement()) {
63402      composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
63403      composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
63404    }
63405  }
63406
63407  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name,
63408      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
63409    if (element != null) {
63410      open(name);
63411      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
63412      close();
63413    }
63414  }
63415
63416  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(
63417      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
63418    composeBackbone(element);
63419    if (element.hasCodeElement()) {
63420      composeStringCore("code", element.getCodeElement(), false);
63421      composeStringExtras("code", element.getCodeElement(), false);
63422    }
63423    if (element.hasIsDefaultElement()) {
63424      composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
63425      composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
63426    }
63427    if (element.hasCompositionalElement()) {
63428      composeBooleanCore("compositional", element.getCompositionalElement(), false);
63429      composeBooleanExtras("compositional", element.getCompositionalElement(), false);
63430    }
63431    if (element.hasLanguage()) {
63432      openArray("language");
63433      for (CodeType e : element.getLanguage())
63434        composeCodeCore(null, e, true);
63435      closeArray();
63436      if (anyHasExtras(element.getLanguage())) {
63437        openArray("_language");
63438        for (CodeType e : element.getLanguage())
63439          composeCodeExtras(null, e, true);
63440        closeArray();
63441      }
63442    }
63443    ;
63444    if (element.hasFilter()) {
63445      openArray("filter");
63446      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter())
63447        composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
63448      closeArray();
63449    }
63450    ;
63451    if (element.hasProperty()) {
63452      openArray("property");
63453      for (CodeType e : element.getProperty())
63454        composeCodeCore(null, e, true);
63455      closeArray();
63456      if (anyHasExtras(element.getProperty())) {
63457        openArray("_property");
63458        for (CodeType e : element.getProperty())
63459          composeCodeExtras(null, e, true);
63460        closeArray();
63461      }
63462    }
63463    ;
63464  }
63465
63466  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name,
63467      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
63468    if (element != null) {
63469      open(name);
63470      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
63471      close();
63472    }
63473  }
63474
63475  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(
63476      TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
63477    composeBackbone(element);
63478    if (element.hasCodeElement()) {
63479      composeCodeCore("code", element.getCodeElement(), false);
63480      composeCodeExtras("code", element.getCodeElement(), false);
63481    }
63482    if (element.hasOp()) {
63483      openArray("op");
63484      for (CodeType e : element.getOp())
63485        composeCodeCore(null, e, true);
63486      closeArray();
63487      if (anyHasExtras(element.getOp())) {
63488        openArray("_op");
63489        for (CodeType e : element.getOp())
63490          composeCodeExtras(null, e, true);
63491        closeArray();
63492      }
63493    }
63494    ;
63495  }
63496
63497  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name,
63498      TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
63499    if (element != null) {
63500      open(name);
63501      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
63502      close();
63503    }
63504  }
63505
63506  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(
63507      TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
63508    composeBackbone(element);
63509    if (element.hasHierarchicalElement()) {
63510      composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
63511      composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
63512    }
63513    if (element.hasPagingElement()) {
63514      composeBooleanCore("paging", element.getPagingElement(), false);
63515      composeBooleanExtras("paging", element.getPagingElement(), false);
63516    }
63517    if (element.hasIncompleteElement()) {
63518      composeBooleanCore("incomplete", element.getIncompleteElement(), false);
63519      composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
63520    }
63521    if (element.hasParameter()) {
63522      openArray("parameter");
63523      for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter())
63524        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(null, e);
63525      closeArray();
63526    }
63527    ;
63528    if (element.hasTextFilterElement()) {
63529      composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
63530      composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
63531    }
63532  }
63533
63534  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name,
63535      TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
63536    if (element != null) {
63537      open(name);
63538      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(element);
63539      close();
63540    }
63541  }
63542
63543  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(
63544      TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
63545    composeBackbone(element);
63546    if (element.hasNameElement()) {
63547      composeCodeCore("name", element.getNameElement(), false);
63548      composeCodeExtras("name", element.getNameElement(), false);
63549    }
63550    if (element.hasDocumentationElement()) {
63551      composeStringCore("documentation", element.getDocumentationElement(), false);
63552      composeStringExtras("documentation", element.getDocumentationElement(), false);
63553    }
63554  }
63555
63556  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name,
63557      TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
63558    if (element != null) {
63559      open(name);
63560      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
63561      close();
63562    }
63563  }
63564
63565  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(
63566      TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
63567    composeBackbone(element);
63568    if (element.hasTranslationsElement()) {
63569      composeBooleanCore("translations", element.getTranslationsElement(), false);
63570      composeBooleanExtras("translations", element.getTranslationsElement(), false);
63571    }
63572  }
63573
63574  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name,
63575      TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
63576    if (element != null) {
63577      open(name);
63578      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
63579      close();
63580    }
63581  }
63582
63583  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(
63584      TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
63585    composeBackbone(element);
63586    if (element.hasNeedsMapElement()) {
63587      composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
63588      composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
63589    }
63590  }
63591
63592  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name,
63593      TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
63594    if (element != null) {
63595      open(name);
63596      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
63597      close();
63598    }
63599  }
63600
63601  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(
63602      TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
63603    composeBackbone(element);
63604    if (element.hasTranslationElement()) {
63605      composeBooleanCore("translation", element.getTranslationElement(), false);
63606      composeBooleanExtras("translation", element.getTranslationElement(), false);
63607    }
63608  }
63609
63610  protected void composeTestReport(String name, TestReport element) throws IOException {
63611    if (element != null) {
63612      prop("resourceType", name);
63613      composeTestReportInner(element);
63614    }
63615  }
63616
63617  protected void composeTestReportInner(TestReport element) throws IOException {
63618    composeDomainResourceElements(element);
63619    if (element.hasIdentifier()) {
63620      composeIdentifier("identifier", element.getIdentifier());
63621    }
63622    if (element.hasNameElement()) {
63623      composeStringCore("name", element.getNameElement(), false);
63624      composeStringExtras("name", element.getNameElement(), false);
63625    }
63626    if (element.hasStatusElement()) {
63627      composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
63628      composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(),
63629          false);
63630    }
63631    if (element.hasTestScript()) {
63632      composeReference("testScript", element.getTestScript());
63633    }
63634    if (element.hasResultElement()) {
63635      composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
63636      composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(),
63637          false);
63638    }
63639    if (element.hasScoreElement()) {
63640      composeDecimalCore("score", element.getScoreElement(), false);
63641      composeDecimalExtras("score", element.getScoreElement(), false);
63642    }
63643    if (element.hasTesterElement()) {
63644      composeStringCore("tester", element.getTesterElement(), false);
63645      composeStringExtras("tester", element.getTesterElement(), false);
63646    }
63647    if (element.hasIssuedElement()) {
63648      composeDateTimeCore("issued", element.getIssuedElement(), false);
63649      composeDateTimeExtras("issued", element.getIssuedElement(), false);
63650    }
63651    if (element.hasParticipant()) {
63652      openArray("participant");
63653      for (TestReport.TestReportParticipantComponent e : element.getParticipant())
63654        composeTestReportTestReportParticipantComponent(null, e);
63655      closeArray();
63656    }
63657    ;
63658    if (element.hasSetup()) {
63659      composeTestReportTestReportSetupComponent("setup", element.getSetup());
63660    }
63661    if (element.hasTest()) {
63662      openArray("test");
63663      for (TestReport.TestReportTestComponent e : element.getTest())
63664        composeTestReportTestReportTestComponent(null, e);
63665      closeArray();
63666    }
63667    ;
63668    if (element.hasTeardown()) {
63669      composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
63670    }
63671  }
63672
63673  protected void composeTestReportTestReportParticipantComponent(String name,
63674      TestReport.TestReportParticipantComponent element) throws IOException {
63675    if (element != null) {
63676      open(name);
63677      composeTestReportTestReportParticipantComponentInner(element);
63678      close();
63679    }
63680  }
63681
63682  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element)
63683      throws IOException {
63684    composeBackbone(element);
63685    if (element.hasTypeElement()) {
63686      composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(),
63687          false);
63688      composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(),
63689          false);
63690    }
63691    if (element.hasUriElement()) {
63692      composeUriCore("uri", element.getUriElement(), false);
63693      composeUriExtras("uri", element.getUriElement(), false);
63694    }
63695    if (element.hasDisplayElement()) {
63696      composeStringCore("display", element.getDisplayElement(), false);
63697      composeStringExtras("display", element.getDisplayElement(), false);
63698    }
63699  }
63700
63701  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element)
63702      throws IOException {
63703    if (element != null) {
63704      open(name);
63705      composeTestReportTestReportSetupComponentInner(element);
63706      close();
63707    }
63708  }
63709
63710  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element)
63711      throws IOException {
63712    composeBackbone(element);
63713    if (element.hasAction()) {
63714      openArray("action");
63715      for (TestReport.SetupActionComponent e : element.getAction())
63716        composeTestReportSetupActionComponent(null, e);
63717      closeArray();
63718    }
63719    ;
63720  }
63721
63722  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element)
63723      throws IOException {
63724    if (element != null) {
63725      open(name);
63726      composeTestReportSetupActionComponentInner(element);
63727      close();
63728    }
63729  }
63730
63731  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element)
63732      throws IOException {
63733    composeBackbone(element);
63734    if (element.hasOperation()) {
63735      composeTestReportSetupActionOperationComponent("operation", element.getOperation());
63736    }
63737    if (element.hasAssert()) {
63738      composeTestReportSetupActionAssertComponent("assert", element.getAssert());
63739    }
63740  }
63741
63742  protected void composeTestReportSetupActionOperationComponent(String name,
63743      TestReport.SetupActionOperationComponent element) throws IOException {
63744    if (element != null) {
63745      open(name);
63746      composeTestReportSetupActionOperationComponentInner(element);
63747      close();
63748    }
63749  }
63750
63751  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element)
63752      throws IOException {
63753    composeBackbone(element);
63754    if (element.hasResultElement()) {
63755      composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(),
63756          false);
63757      composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(),
63758          false);
63759    }
63760    if (element.hasMessageElement()) {
63761      composeMarkdownCore("message", element.getMessageElement(), false);
63762      composeMarkdownExtras("message", element.getMessageElement(), false);
63763    }
63764    if (element.hasDetailElement()) {
63765      composeUriCore("detail", element.getDetailElement(), false);
63766      composeUriExtras("detail", element.getDetailElement(), false);
63767    }
63768  }
63769
63770  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element)
63771      throws IOException {
63772    if (element != null) {
63773      open(name);
63774      composeTestReportSetupActionAssertComponentInner(element);
63775      close();
63776    }
63777  }
63778
63779  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element)
63780      throws IOException {
63781    composeBackbone(element);
63782    if (element.hasResultElement()) {
63783      composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(),
63784          false);
63785      composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(),
63786          false);
63787    }
63788    if (element.hasMessageElement()) {
63789      composeMarkdownCore("message", element.getMessageElement(), false);
63790      composeMarkdownExtras("message", element.getMessageElement(), false);
63791    }
63792    if (element.hasDetailElement()) {
63793      composeStringCore("detail", element.getDetailElement(), false);
63794      composeStringExtras("detail", element.getDetailElement(), false);
63795    }
63796  }
63797
63798  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element)
63799      throws IOException {
63800    if (element != null) {
63801      open(name);
63802      composeTestReportTestReportTestComponentInner(element);
63803      close();
63804    }
63805  }
63806
63807  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element)
63808      throws IOException {
63809    composeBackbone(element);
63810    if (element.hasNameElement()) {
63811      composeStringCore("name", element.getNameElement(), false);
63812      composeStringExtras("name", element.getNameElement(), false);
63813    }
63814    if (element.hasDescriptionElement()) {
63815      composeStringCore("description", element.getDescriptionElement(), false);
63816      composeStringExtras("description", element.getDescriptionElement(), false);
63817    }
63818    if (element.hasAction()) {
63819      openArray("action");
63820      for (TestReport.TestActionComponent e : element.getAction())
63821        composeTestReportTestActionComponent(null, e);
63822      closeArray();
63823    }
63824    ;
63825  }
63826
63827  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element)
63828      throws IOException {
63829    if (element != null) {
63830      open(name);
63831      composeTestReportTestActionComponentInner(element);
63832      close();
63833    }
63834  }
63835
63836  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
63837    composeBackbone(element);
63838    if (element.hasOperation()) {
63839      composeTestReportSetupActionOperationComponent("operation", element.getOperation());
63840    }
63841    if (element.hasAssert()) {
63842      composeTestReportSetupActionAssertComponent("assert", element.getAssert());
63843    }
63844  }
63845
63846  protected void composeTestReportTestReportTeardownComponent(String name,
63847      TestReport.TestReportTeardownComponent element) throws IOException {
63848    if (element != null) {
63849      open(name);
63850      composeTestReportTestReportTeardownComponentInner(element);
63851      close();
63852    }
63853  }
63854
63855  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element)
63856      throws IOException {
63857    composeBackbone(element);
63858    if (element.hasAction()) {
63859      openArray("action");
63860      for (TestReport.TeardownActionComponent e : element.getAction())
63861        composeTestReportTeardownActionComponent(null, e);
63862      closeArray();
63863    }
63864    ;
63865  }
63866
63867  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element)
63868      throws IOException {
63869    if (element != null) {
63870      open(name);
63871      composeTestReportTeardownActionComponentInner(element);
63872      close();
63873    }
63874  }
63875
63876  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element)
63877      throws IOException {
63878    composeBackbone(element);
63879    if (element.hasOperation()) {
63880      composeTestReportSetupActionOperationComponent("operation", element.getOperation());
63881    }
63882  }
63883
63884  protected void composeTestScript(String name, TestScript element) throws IOException {
63885    if (element != null) {
63886      prop("resourceType", name);
63887      composeTestScriptInner(element);
63888    }
63889  }
63890
63891  protected void composeTestScriptInner(TestScript element) throws IOException {
63892    composeDomainResourceElements(element);
63893    if (element.hasUrlElement()) {
63894      composeUriCore("url", element.getUrlElement(), false);
63895      composeUriExtras("url", element.getUrlElement(), false);
63896    }
63897    if (element.hasIdentifier()) {
63898      composeIdentifier("identifier", element.getIdentifier());
63899    }
63900    if (element.hasVersionElement()) {
63901      composeStringCore("version", element.getVersionElement(), false);
63902      composeStringExtras("version", element.getVersionElement(), false);
63903    }
63904    if (element.hasNameElement()) {
63905      composeStringCore("name", element.getNameElement(), false);
63906      composeStringExtras("name", element.getNameElement(), false);
63907    }
63908    if (element.hasTitleElement()) {
63909      composeStringCore("title", element.getTitleElement(), false);
63910      composeStringExtras("title", element.getTitleElement(), false);
63911    }
63912    if (element.hasStatusElement()) {
63913      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
63914          false);
63915      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
63916          false);
63917    }
63918    if (element.hasExperimentalElement()) {
63919      composeBooleanCore("experimental", element.getExperimentalElement(), false);
63920      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
63921    }
63922    if (element.hasDateElement()) {
63923      composeDateTimeCore("date", element.getDateElement(), false);
63924      composeDateTimeExtras("date", element.getDateElement(), false);
63925    }
63926    if (element.hasPublisherElement()) {
63927      composeStringCore("publisher", element.getPublisherElement(), false);
63928      composeStringExtras("publisher", element.getPublisherElement(), false);
63929    }
63930    if (element.hasContact()) {
63931      openArray("contact");
63932      for (ContactDetail e : element.getContact())
63933        composeContactDetail(null, e);
63934      closeArray();
63935    }
63936    ;
63937    if (element.hasDescriptionElement()) {
63938      composeMarkdownCore("description", element.getDescriptionElement(), false);
63939      composeMarkdownExtras("description", element.getDescriptionElement(), false);
63940    }
63941    if (element.hasUseContext()) {
63942      openArray("useContext");
63943      for (UsageContext e : element.getUseContext())
63944        composeUsageContext(null, e);
63945      closeArray();
63946    }
63947    ;
63948    if (element.hasJurisdiction()) {
63949      openArray("jurisdiction");
63950      for (CodeableConcept e : element.getJurisdiction())
63951        composeCodeableConcept(null, e);
63952      closeArray();
63953    }
63954    ;
63955    if (element.hasPurposeElement()) {
63956      composeMarkdownCore("purpose", element.getPurposeElement(), false);
63957      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
63958    }
63959    if (element.hasCopyrightElement()) {
63960      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
63961      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
63962    }
63963    if (element.hasOrigin()) {
63964      openArray("origin");
63965      for (TestScript.TestScriptOriginComponent e : element.getOrigin())
63966        composeTestScriptTestScriptOriginComponent(null, e);
63967      closeArray();
63968    }
63969    ;
63970    if (element.hasDestination()) {
63971      openArray("destination");
63972      for (TestScript.TestScriptDestinationComponent e : element.getDestination())
63973        composeTestScriptTestScriptDestinationComponent(null, e);
63974      closeArray();
63975    }
63976    ;
63977    if (element.hasMetadata()) {
63978      composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
63979    }
63980    if (element.hasFixture()) {
63981      openArray("fixture");
63982      for (TestScript.TestScriptFixtureComponent e : element.getFixture())
63983        composeTestScriptTestScriptFixtureComponent(null, e);
63984      closeArray();
63985    }
63986    ;
63987    if (element.hasProfile()) {
63988      openArray("profile");
63989      for (Reference e : element.getProfile())
63990        composeReference(null, e);
63991      closeArray();
63992    }
63993    ;
63994    if (element.hasVariable()) {
63995      openArray("variable");
63996      for (TestScript.TestScriptVariableComponent e : element.getVariable())
63997        composeTestScriptTestScriptVariableComponent(null, e);
63998      closeArray();
63999    }
64000    ;
64001    if (element.hasSetup()) {
64002      composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
64003    }
64004    if (element.hasTest()) {
64005      openArray("test");
64006      for (TestScript.TestScriptTestComponent e : element.getTest())
64007        composeTestScriptTestScriptTestComponent(null, e);
64008      closeArray();
64009    }
64010    ;
64011    if (element.hasTeardown()) {
64012      composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
64013    }
64014  }
64015
64016  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element)
64017      throws IOException {
64018    if (element != null) {
64019      open(name);
64020      composeTestScriptTestScriptOriginComponentInner(element);
64021      close();
64022    }
64023  }
64024
64025  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element)
64026      throws IOException {
64027    composeBackbone(element);
64028    if (element.hasIndexElement()) {
64029      composeIntegerCore("index", element.getIndexElement(), false);
64030      composeIntegerExtras("index", element.getIndexElement(), false);
64031    }
64032    if (element.hasProfile()) {
64033      composeCoding("profile", element.getProfile());
64034    }
64035  }
64036
64037  protected void composeTestScriptTestScriptDestinationComponent(String name,
64038      TestScript.TestScriptDestinationComponent element) throws IOException {
64039    if (element != null) {
64040      open(name);
64041      composeTestScriptTestScriptDestinationComponentInner(element);
64042      close();
64043    }
64044  }
64045
64046  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element)
64047      throws IOException {
64048    composeBackbone(element);
64049    if (element.hasIndexElement()) {
64050      composeIntegerCore("index", element.getIndexElement(), false);
64051      composeIntegerExtras("index", element.getIndexElement(), false);
64052    }
64053    if (element.hasProfile()) {
64054      composeCoding("profile", element.getProfile());
64055    }
64056  }
64057
64058  protected void composeTestScriptTestScriptMetadataComponent(String name,
64059      TestScript.TestScriptMetadataComponent element) throws IOException {
64060    if (element != null) {
64061      open(name);
64062      composeTestScriptTestScriptMetadataComponentInner(element);
64063      close();
64064    }
64065  }
64066
64067  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element)
64068      throws IOException {
64069    composeBackbone(element);
64070    if (element.hasLink()) {
64071      openArray("link");
64072      for (TestScript.TestScriptMetadataLinkComponent e : element.getLink())
64073        composeTestScriptTestScriptMetadataLinkComponent(null, e);
64074      closeArray();
64075    }
64076    ;
64077    if (element.hasCapability()) {
64078      openArray("capability");
64079      for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability())
64080        composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
64081      closeArray();
64082    }
64083    ;
64084  }
64085
64086  protected void composeTestScriptTestScriptMetadataLinkComponent(String name,
64087      TestScript.TestScriptMetadataLinkComponent element) throws IOException {
64088    if (element != null) {
64089      open(name);
64090      composeTestScriptTestScriptMetadataLinkComponentInner(element);
64091      close();
64092    }
64093  }
64094
64095  protected void composeTestScriptTestScriptMetadataLinkComponentInner(
64096      TestScript.TestScriptMetadataLinkComponent element) throws IOException {
64097    composeBackbone(element);
64098    if (element.hasUrlElement()) {
64099      composeUriCore("url", element.getUrlElement(), false);
64100      composeUriExtras("url", element.getUrlElement(), false);
64101    }
64102    if (element.hasDescriptionElement()) {
64103      composeStringCore("description", element.getDescriptionElement(), false);
64104      composeStringExtras("description", element.getDescriptionElement(), false);
64105    }
64106  }
64107
64108  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name,
64109      TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
64110    if (element != null) {
64111      open(name);
64112      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
64113      close();
64114    }
64115  }
64116
64117  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(
64118      TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
64119    composeBackbone(element);
64120    if (element.hasRequiredElement()) {
64121      composeBooleanCore("required", element.getRequiredElement(), false);
64122      composeBooleanExtras("required", element.getRequiredElement(), false);
64123    }
64124    if (element.hasValidatedElement()) {
64125      composeBooleanCore("validated", element.getValidatedElement(), false);
64126      composeBooleanExtras("validated", element.getValidatedElement(), false);
64127    }
64128    if (element.hasDescriptionElement()) {
64129      composeStringCore("description", element.getDescriptionElement(), false);
64130      composeStringExtras("description", element.getDescriptionElement(), false);
64131    }
64132    if (element.hasOrigin()) {
64133      openArray("origin");
64134      for (IntegerType e : element.getOrigin())
64135        composeIntegerCore(null, e, true);
64136      closeArray();
64137      if (anyHasExtras(element.getOrigin())) {
64138        openArray("_origin");
64139        for (IntegerType e : element.getOrigin())
64140          composeIntegerExtras(null, e, true);
64141        closeArray();
64142      }
64143    }
64144    ;
64145    if (element.hasDestinationElement()) {
64146      composeIntegerCore("destination", element.getDestinationElement(), false);
64147      composeIntegerExtras("destination", element.getDestinationElement(), false);
64148    }
64149    if (element.hasLink()) {
64150      openArray("link");
64151      for (UriType e : element.getLink())
64152        composeUriCore(null, e, true);
64153      closeArray();
64154      if (anyHasExtras(element.getLink())) {
64155        openArray("_link");
64156        for (UriType e : element.getLink())
64157          composeUriExtras(null, e, true);
64158        closeArray();
64159      }
64160    }
64161    ;
64162    if (element.hasCapabilitiesElement()) {
64163      composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
64164      composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
64165    }
64166  }
64167
64168  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element)
64169      throws IOException {
64170    if (element != null) {
64171      open(name);
64172      composeTestScriptTestScriptFixtureComponentInner(element);
64173      close();
64174    }
64175  }
64176
64177  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element)
64178      throws IOException {
64179    composeBackbone(element);
64180    if (element.hasAutocreateElement()) {
64181      composeBooleanCore("autocreate", element.getAutocreateElement(), false);
64182      composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
64183    }
64184    if (element.hasAutodeleteElement()) {
64185      composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
64186      composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
64187    }
64188    if (element.hasResource()) {
64189      composeReference("resource", element.getResource());
64190    }
64191  }
64192
64193  protected void composeTestScriptTestScriptVariableComponent(String name,
64194      TestScript.TestScriptVariableComponent element) throws IOException {
64195    if (element != null) {
64196      open(name);
64197      composeTestScriptTestScriptVariableComponentInner(element);
64198      close();
64199    }
64200  }
64201
64202  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element)
64203      throws IOException {
64204    composeBackbone(element);
64205    if (element.hasNameElement()) {
64206      composeStringCore("name", element.getNameElement(), false);
64207      composeStringExtras("name", element.getNameElement(), false);
64208    }
64209    if (element.hasDefaultValueElement()) {
64210      composeStringCore("defaultValue", element.getDefaultValueElement(), false);
64211      composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
64212    }
64213    if (element.hasDescriptionElement()) {
64214      composeStringCore("description", element.getDescriptionElement(), false);
64215      composeStringExtras("description", element.getDescriptionElement(), false);
64216    }
64217    if (element.hasExpressionElement()) {
64218      composeStringCore("expression", element.getExpressionElement(), false);
64219      composeStringExtras("expression", element.getExpressionElement(), false);
64220    }
64221    if (element.hasHeaderFieldElement()) {
64222      composeStringCore("headerField", element.getHeaderFieldElement(), false);
64223      composeStringExtras("headerField", element.getHeaderFieldElement(), false);
64224    }
64225    if (element.hasHintElement()) {
64226      composeStringCore("hint", element.getHintElement(), false);
64227      composeStringExtras("hint", element.getHintElement(), false);
64228    }
64229    if (element.hasPathElement()) {
64230      composeStringCore("path", element.getPathElement(), false);
64231      composeStringExtras("path", element.getPathElement(), false);
64232    }
64233    if (element.hasSourceIdElement()) {
64234      composeIdCore("sourceId", element.getSourceIdElement(), false);
64235      composeIdExtras("sourceId", element.getSourceIdElement(), false);
64236    }
64237  }
64238
64239  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element)
64240      throws IOException {
64241    if (element != null) {
64242      open(name);
64243      composeTestScriptTestScriptSetupComponentInner(element);
64244      close();
64245    }
64246  }
64247
64248  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element)
64249      throws IOException {
64250    composeBackbone(element);
64251    if (element.hasAction()) {
64252      openArray("action");
64253      for (TestScript.SetupActionComponent e : element.getAction())
64254        composeTestScriptSetupActionComponent(null, e);
64255      closeArray();
64256    }
64257    ;
64258  }
64259
64260  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element)
64261      throws IOException {
64262    if (element != null) {
64263      open(name);
64264      composeTestScriptSetupActionComponentInner(element);
64265      close();
64266    }
64267  }
64268
64269  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element)
64270      throws IOException {
64271    composeBackbone(element);
64272    if (element.hasOperation()) {
64273      composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
64274    }
64275    if (element.hasAssert()) {
64276      composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
64277    }
64278  }
64279
64280  protected void composeTestScriptSetupActionOperationComponent(String name,
64281      TestScript.SetupActionOperationComponent element) throws IOException {
64282    if (element != null) {
64283      open(name);
64284      composeTestScriptSetupActionOperationComponentInner(element);
64285      close();
64286    }
64287  }
64288
64289  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element)
64290      throws IOException {
64291    composeBackbone(element);
64292    if (element.hasType()) {
64293      composeCoding("type", element.getType());
64294    }
64295    if (element.hasResourceElement()) {
64296      composeCodeCore("resource", element.getResourceElement(), false);
64297      composeCodeExtras("resource", element.getResourceElement(), false);
64298    }
64299    if (element.hasLabelElement()) {
64300      composeStringCore("label", element.getLabelElement(), false);
64301      composeStringExtras("label", element.getLabelElement(), false);
64302    }
64303    if (element.hasDescriptionElement()) {
64304      composeStringCore("description", element.getDescriptionElement(), false);
64305      composeStringExtras("description", element.getDescriptionElement(), false);
64306    }
64307    if (element.hasAcceptElement()) {
64308      composeCodeCore("accept", element.getAcceptElement(), false);
64309      composeCodeExtras("accept", element.getAcceptElement(), false);
64310    }
64311    if (element.hasContentTypeElement()) {
64312      composeCodeCore("contentType", element.getContentTypeElement(), false);
64313      composeCodeExtras("contentType", element.getContentTypeElement(), false);
64314    }
64315    if (element.hasDestinationElement()) {
64316      composeIntegerCore("destination", element.getDestinationElement(), false);
64317      composeIntegerExtras("destination", element.getDestinationElement(), false);
64318    }
64319    if (element.hasEncodeRequestUrlElement()) {
64320      composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
64321      composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
64322    }
64323    if (element.hasMethodElement()) {
64324      composeEnumerationCore("method", element.getMethodElement(),
64325          new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
64326      composeEnumerationExtras("method", element.getMethodElement(),
64327          new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
64328    }
64329    if (element.hasOriginElement()) {
64330      composeIntegerCore("origin", element.getOriginElement(), false);
64331      composeIntegerExtras("origin", element.getOriginElement(), false);
64332    }
64333    if (element.hasParamsElement()) {
64334      composeStringCore("params", element.getParamsElement(), false);
64335      composeStringExtras("params", element.getParamsElement(), false);
64336    }
64337    if (element.hasRequestHeader()) {
64338      openArray("requestHeader");
64339      for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader())
64340        composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
64341      closeArray();
64342    }
64343    ;
64344    if (element.hasRequestIdElement()) {
64345      composeIdCore("requestId", element.getRequestIdElement(), false);
64346      composeIdExtras("requestId", element.getRequestIdElement(), false);
64347    }
64348    if (element.hasResponseIdElement()) {
64349      composeIdCore("responseId", element.getResponseIdElement(), false);
64350      composeIdExtras("responseId", element.getResponseIdElement(), false);
64351    }
64352    if (element.hasSourceIdElement()) {
64353      composeIdCore("sourceId", element.getSourceIdElement(), false);
64354      composeIdExtras("sourceId", element.getSourceIdElement(), false);
64355    }
64356    if (element.hasTargetIdElement()) {
64357      composeIdCore("targetId", element.getTargetIdElement(), false);
64358      composeIdExtras("targetId", element.getTargetIdElement(), false);
64359    }
64360    if (element.hasUrlElement()) {
64361      composeStringCore("url", element.getUrlElement(), false);
64362      composeStringExtras("url", element.getUrlElement(), false);
64363    }
64364  }
64365
64366  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name,
64367      TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
64368    if (element != null) {
64369      open(name);
64370      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
64371      close();
64372    }
64373  }
64374
64375  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(
64376      TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
64377    composeBackbone(element);
64378    if (element.hasFieldElement()) {
64379      composeStringCore("field", element.getFieldElement(), false);
64380      composeStringExtras("field", element.getFieldElement(), false);
64381    }
64382    if (element.hasValueElement()) {
64383      composeStringCore("value", element.getValueElement(), false);
64384      composeStringExtras("value", element.getValueElement(), false);
64385    }
64386  }
64387
64388  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element)
64389      throws IOException {
64390    if (element != null) {
64391      open(name);
64392      composeTestScriptSetupActionAssertComponentInner(element);
64393      close();
64394    }
64395  }
64396
64397  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element)
64398      throws IOException {
64399    composeBackbone(element);
64400    if (element.hasLabelElement()) {
64401      composeStringCore("label", element.getLabelElement(), false);
64402      composeStringExtras("label", element.getLabelElement(), false);
64403    }
64404    if (element.hasDescriptionElement()) {
64405      composeStringCore("description", element.getDescriptionElement(), false);
64406      composeStringExtras("description", element.getDescriptionElement(), false);
64407    }
64408    if (element.hasDirectionElement()) {
64409      composeEnumerationCore("direction", element.getDirectionElement(),
64410          new TestScript.AssertionDirectionTypeEnumFactory(), false);
64411      composeEnumerationExtras("direction", element.getDirectionElement(),
64412          new TestScript.AssertionDirectionTypeEnumFactory(), false);
64413    }
64414    if (element.hasCompareToSourceIdElement()) {
64415      composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
64416      composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
64417    }
64418    if (element.hasCompareToSourceExpressionElement()) {
64419      composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
64420      composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
64421    }
64422    if (element.hasCompareToSourcePathElement()) {
64423      composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
64424      composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
64425    }
64426    if (element.hasContentTypeElement()) {
64427      composeCodeCore("contentType", element.getContentTypeElement(), false);
64428      composeCodeExtras("contentType", element.getContentTypeElement(), false);
64429    }
64430    if (element.hasExpressionElement()) {
64431      composeStringCore("expression", element.getExpressionElement(), false);
64432      composeStringExtras("expression", element.getExpressionElement(), false);
64433    }
64434    if (element.hasHeaderFieldElement()) {
64435      composeStringCore("headerField", element.getHeaderFieldElement(), false);
64436      composeStringExtras("headerField", element.getHeaderFieldElement(), false);
64437    }
64438    if (element.hasMinimumIdElement()) {
64439      composeStringCore("minimumId", element.getMinimumIdElement(), false);
64440      composeStringExtras("minimumId", element.getMinimumIdElement(), false);
64441    }
64442    if (element.hasNavigationLinksElement()) {
64443      composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
64444      composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
64445    }
64446    if (element.hasOperatorElement()) {
64447      composeEnumerationCore("operator", element.getOperatorElement(),
64448          new TestScript.AssertionOperatorTypeEnumFactory(), false);
64449      composeEnumerationExtras("operator", element.getOperatorElement(),
64450          new TestScript.AssertionOperatorTypeEnumFactory(), false);
64451    }
64452    if (element.hasPathElement()) {
64453      composeStringCore("path", element.getPathElement(), false);
64454      composeStringExtras("path", element.getPathElement(), false);
64455    }
64456    if (element.hasRequestMethodElement()) {
64457      composeEnumerationCore("requestMethod", element.getRequestMethodElement(),
64458          new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
64459      composeEnumerationExtras("requestMethod", element.getRequestMethodElement(),
64460          new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
64461    }
64462    if (element.hasRequestURLElement()) {
64463      composeStringCore("requestURL", element.getRequestURLElement(), false);
64464      composeStringExtras("requestURL", element.getRequestURLElement(), false);
64465    }
64466    if (element.hasResourceElement()) {
64467      composeCodeCore("resource", element.getResourceElement(), false);
64468      composeCodeExtras("resource", element.getResourceElement(), false);
64469    }
64470    if (element.hasResponseElement()) {
64471      composeEnumerationCore("response", element.getResponseElement(),
64472          new TestScript.AssertionResponseTypesEnumFactory(), false);
64473      composeEnumerationExtras("response", element.getResponseElement(),
64474          new TestScript.AssertionResponseTypesEnumFactory(), false);
64475    }
64476    if (element.hasResponseCodeElement()) {
64477      composeStringCore("responseCode", element.getResponseCodeElement(), false);
64478      composeStringExtras("responseCode", element.getResponseCodeElement(), false);
64479    }
64480    if (element.hasSourceIdElement()) {
64481      composeIdCore("sourceId", element.getSourceIdElement(), false);
64482      composeIdExtras("sourceId", element.getSourceIdElement(), false);
64483    }
64484    if (element.hasValidateProfileIdElement()) {
64485      composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
64486      composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
64487    }
64488    if (element.hasValueElement()) {
64489      composeStringCore("value", element.getValueElement(), false);
64490      composeStringExtras("value", element.getValueElement(), false);
64491    }
64492    if (element.hasWarningOnlyElement()) {
64493      composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
64494      composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
64495    }
64496  }
64497
64498  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element)
64499      throws IOException {
64500    if (element != null) {
64501      open(name);
64502      composeTestScriptTestScriptTestComponentInner(element);
64503      close();
64504    }
64505  }
64506
64507  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element)
64508      throws IOException {
64509    composeBackbone(element);
64510    if (element.hasNameElement()) {
64511      composeStringCore("name", element.getNameElement(), false);
64512      composeStringExtras("name", element.getNameElement(), false);
64513    }
64514    if (element.hasDescriptionElement()) {
64515      composeStringCore("description", element.getDescriptionElement(), false);
64516      composeStringExtras("description", element.getDescriptionElement(), false);
64517    }
64518    if (element.hasAction()) {
64519      openArray("action");
64520      for (TestScript.TestActionComponent e : element.getAction())
64521        composeTestScriptTestActionComponent(null, e);
64522      closeArray();
64523    }
64524    ;
64525  }
64526
64527  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element)
64528      throws IOException {
64529    if (element != null) {
64530      open(name);
64531      composeTestScriptTestActionComponentInner(element);
64532      close();
64533    }
64534  }
64535
64536  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
64537    composeBackbone(element);
64538    if (element.hasOperation()) {
64539      composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
64540    }
64541    if (element.hasAssert()) {
64542      composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
64543    }
64544  }
64545
64546  protected void composeTestScriptTestScriptTeardownComponent(String name,
64547      TestScript.TestScriptTeardownComponent element) throws IOException {
64548    if (element != null) {
64549      open(name);
64550      composeTestScriptTestScriptTeardownComponentInner(element);
64551      close();
64552    }
64553  }
64554
64555  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element)
64556      throws IOException {
64557    composeBackbone(element);
64558    if (element.hasAction()) {
64559      openArray("action");
64560      for (TestScript.TeardownActionComponent e : element.getAction())
64561        composeTestScriptTeardownActionComponent(null, e);
64562      closeArray();
64563    }
64564    ;
64565  }
64566
64567  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element)
64568      throws IOException {
64569    if (element != null) {
64570      open(name);
64571      composeTestScriptTeardownActionComponentInner(element);
64572      close();
64573    }
64574  }
64575
64576  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element)
64577      throws IOException {
64578    composeBackbone(element);
64579    if (element.hasOperation()) {
64580      composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
64581    }
64582  }
64583
64584  protected void composeValueSet(String name, ValueSet element) throws IOException {
64585    if (element != null) {
64586      prop("resourceType", name);
64587      composeValueSetInner(element);
64588    }
64589  }
64590
64591  protected void composeValueSetInner(ValueSet element) throws IOException {
64592    composeDomainResourceElements(element);
64593    if (element.hasUrlElement()) {
64594      composeUriCore("url", element.getUrlElement(), false);
64595      composeUriExtras("url", element.getUrlElement(), false);
64596    }
64597    if (element.hasIdentifier()) {
64598      openArray("identifier");
64599      for (Identifier e : element.getIdentifier())
64600        composeIdentifier(null, e);
64601      closeArray();
64602    }
64603    ;
64604    if (element.hasVersionElement()) {
64605      composeStringCore("version", element.getVersionElement(), false);
64606      composeStringExtras("version", element.getVersionElement(), false);
64607    }
64608    if (element.hasNameElement()) {
64609      composeStringCore("name", element.getNameElement(), false);
64610      composeStringExtras("name", element.getNameElement(), false);
64611    }
64612    if (element.hasTitleElement()) {
64613      composeStringCore("title", element.getTitleElement(), false);
64614      composeStringExtras("title", element.getTitleElement(), false);
64615    }
64616    if (element.hasStatusElement()) {
64617      composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
64618          false);
64619      composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(),
64620          false);
64621    }
64622    if (element.hasExperimentalElement()) {
64623      composeBooleanCore("experimental", element.getExperimentalElement(), false);
64624      composeBooleanExtras("experimental", element.getExperimentalElement(), false);
64625    }
64626    if (element.hasDateElement()) {
64627      composeDateTimeCore("date", element.getDateElement(), false);
64628      composeDateTimeExtras("date", element.getDateElement(), false);
64629    }
64630    if (element.hasPublisherElement()) {
64631      composeStringCore("publisher", element.getPublisherElement(), false);
64632      composeStringExtras("publisher", element.getPublisherElement(), false);
64633    }
64634    if (element.hasContact()) {
64635      openArray("contact");
64636      for (ContactDetail e : element.getContact())
64637        composeContactDetail(null, e);
64638      closeArray();
64639    }
64640    ;
64641    if (element.hasDescriptionElement()) {
64642      composeMarkdownCore("description", element.getDescriptionElement(), false);
64643      composeMarkdownExtras("description", element.getDescriptionElement(), false);
64644    }
64645    if (element.hasUseContext()) {
64646      openArray("useContext");
64647      for (UsageContext e : element.getUseContext())
64648        composeUsageContext(null, e);
64649      closeArray();
64650    }
64651    ;
64652    if (element.hasJurisdiction()) {
64653      openArray("jurisdiction");
64654      for (CodeableConcept e : element.getJurisdiction())
64655        composeCodeableConcept(null, e);
64656      closeArray();
64657    }
64658    ;
64659    if (element.hasImmutableElement()) {
64660      composeBooleanCore("immutable", element.getImmutableElement(), false);
64661      composeBooleanExtras("immutable", element.getImmutableElement(), false);
64662    }
64663    if (element.hasPurposeElement()) {
64664      composeMarkdownCore("purpose", element.getPurposeElement(), false);
64665      composeMarkdownExtras("purpose", element.getPurposeElement(), false);
64666    }
64667    if (element.hasCopyrightElement()) {
64668      composeMarkdownCore("copyright", element.getCopyrightElement(), false);
64669      composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
64670    }
64671    if (element.hasCompose()) {
64672      composeValueSetValueSetComposeComponent("compose", element.getCompose());
64673    }
64674    if (element.hasExpansion()) {
64675      composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
64676    }
64677  }
64678
64679  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element)
64680      throws IOException {
64681    if (element != null) {
64682      open(name);
64683      composeValueSetValueSetComposeComponentInner(element);
64684      close();
64685    }
64686  }
64687
64688  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element)
64689      throws IOException {
64690    composeBackbone(element);
64691    if (element.hasLockedDateElement()) {
64692      composeDateCore("lockedDate", element.getLockedDateElement(), false);
64693      composeDateExtras("lockedDate", element.getLockedDateElement(), false);
64694    }
64695    if (element.hasInactiveElement()) {
64696      composeBooleanCore("inactive", element.getInactiveElement(), false);
64697      composeBooleanExtras("inactive", element.getInactiveElement(), false);
64698    }
64699    if (element.hasInclude()) {
64700      openArray("include");
64701      for (ValueSet.ConceptSetComponent e : element.getInclude())
64702        composeValueSetConceptSetComponent(null, e);
64703      closeArray();
64704    }
64705    ;
64706    if (element.hasExclude()) {
64707      openArray("exclude");
64708      for (ValueSet.ConceptSetComponent e : element.getExclude())
64709        composeValueSetConceptSetComponent(null, e);
64710      closeArray();
64711    }
64712    ;
64713  }
64714
64715  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element)
64716      throws IOException {
64717    if (element != null) {
64718      open(name);
64719      composeValueSetConceptSetComponentInner(element);
64720      close();
64721    }
64722  }
64723
64724  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
64725    composeBackbone(element);
64726    if (element.hasSystemElement()) {
64727      composeUriCore("system", element.getSystemElement(), false);
64728      composeUriExtras("system", element.getSystemElement(), false);
64729    }
64730    if (element.hasVersionElement()) {
64731      composeStringCore("version", element.getVersionElement(), false);
64732      composeStringExtras("version", element.getVersionElement(), false);
64733    }
64734    if (element.hasConcept()) {
64735      openArray("concept");
64736      for (ValueSet.ConceptReferenceComponent e : element.getConcept())
64737        composeValueSetConceptReferenceComponent(null, e);
64738      closeArray();
64739    }
64740    ;
64741    if (element.hasFilter()) {
64742      openArray("filter");
64743      for (ValueSet.ConceptSetFilterComponent e : element.getFilter())
64744        composeValueSetConceptSetFilterComponent(null, e);
64745      closeArray();
64746    }
64747    ;
64748    if (element.hasValueSet()) {
64749      openArray("valueSet");
64750      for (CanonicalType e : element.getValueSet())
64751        composeCanonicalCore(null, e, true);
64752      closeArray();
64753      if (anyHasExtras(element.getValueSet())) {
64754        openArray("_valueSet");
64755        for (CanonicalType e : element.getValueSet())
64756          composeCanonicalExtras(null, e, true);
64757        closeArray();
64758      }
64759    }
64760    ;
64761  }
64762
64763  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element)
64764      throws IOException {
64765    if (element != null) {
64766      open(name);
64767      composeValueSetConceptReferenceComponentInner(element);
64768      close();
64769    }
64770  }
64771
64772  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element)
64773      throws IOException {
64774    composeBackbone(element);
64775    if (element.hasCodeElement()) {
64776      composeCodeCore("code", element.getCodeElement(), false);
64777      composeCodeExtras("code", element.getCodeElement(), false);
64778    }
64779    if (element.hasDisplayElement()) {
64780      composeStringCore("display", element.getDisplayElement(), false);
64781      composeStringExtras("display", element.getDisplayElement(), false);
64782    }
64783    if (element.hasDesignation()) {
64784      openArray("designation");
64785      for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation())
64786        composeValueSetConceptReferenceDesignationComponent(null, e);
64787      closeArray();
64788    }
64789    ;
64790  }
64791
64792  protected void composeValueSetConceptReferenceDesignationComponent(String name,
64793      ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
64794    if (element != null) {
64795      open(name);
64796      composeValueSetConceptReferenceDesignationComponentInner(element);
64797      close();
64798    }
64799  }
64800
64801  protected void composeValueSetConceptReferenceDesignationComponentInner(
64802      ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
64803    composeBackbone(element);
64804    if (element.hasLanguageElement()) {
64805      composeCodeCore("language", element.getLanguageElement(), false);
64806      composeCodeExtras("language", element.getLanguageElement(), false);
64807    }
64808    if (element.hasUse()) {
64809      composeCoding("use", element.getUse());
64810    }
64811    if (element.hasValueElement()) {
64812      composeStringCore("value", element.getValueElement(), false);
64813      composeStringExtras("value", element.getValueElement(), false);
64814    }
64815  }
64816
64817  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element)
64818      throws IOException {
64819    if (element != null) {
64820      open(name);
64821      composeValueSetConceptSetFilterComponentInner(element);
64822      close();
64823    }
64824  }
64825
64826  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element)
64827      throws IOException {
64828    composeBackbone(element);
64829    if (element.hasPropertyElement()) {
64830      composeCodeCore("property", element.getPropertyElement(), false);
64831      composeCodeExtras("property", element.getPropertyElement(), false);
64832    }
64833    if (element.hasOpElement()) {
64834      composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
64835      composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
64836    }
64837    if (element.hasValueElement()) {
64838      composeStringCore("value", element.getValueElement(), false);
64839      composeStringExtras("value", element.getValueElement(), false);
64840    }
64841  }
64842
64843  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element)
64844      throws IOException {
64845    if (element != null) {
64846      open(name);
64847      composeValueSetValueSetExpansionComponentInner(element);
64848      close();
64849    }
64850  }
64851
64852  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element)
64853      throws IOException {
64854    composeBackbone(element);
64855    if (element.hasIdentifierElement()) {
64856      composeUriCore("identifier", element.getIdentifierElement(), false);
64857      composeUriExtras("identifier", element.getIdentifierElement(), false);
64858    }
64859    if (element.hasTimestampElement()) {
64860      composeDateTimeCore("timestamp", element.getTimestampElement(), false);
64861      composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
64862    }
64863    if (element.hasTotalElement()) {
64864      composeIntegerCore("total", element.getTotalElement(), false);
64865      composeIntegerExtras("total", element.getTotalElement(), false);
64866    }
64867    if (element.hasOffsetElement()) {
64868      composeIntegerCore("offset", element.getOffsetElement(), false);
64869      composeIntegerExtras("offset", element.getOffsetElement(), false);
64870    }
64871    if (element.hasParameter()) {
64872      openArray("parameter");
64873      for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter())
64874        composeValueSetValueSetExpansionParameterComponent(null, e);
64875      closeArray();
64876    }
64877    ;
64878    if (element.hasContains()) {
64879      openArray("contains");
64880      for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains())
64881        composeValueSetValueSetExpansionContainsComponent(null, e);
64882      closeArray();
64883    }
64884    ;
64885  }
64886
64887  protected void composeValueSetValueSetExpansionParameterComponent(String name,
64888      ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
64889    if (element != null) {
64890      open(name);
64891      composeValueSetValueSetExpansionParameterComponentInner(element);
64892      close();
64893    }
64894  }
64895
64896  protected void composeValueSetValueSetExpansionParameterComponentInner(
64897      ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
64898    composeBackbone(element);
64899    if (element.hasNameElement()) {
64900      composeStringCore("name", element.getNameElement(), false);
64901      composeStringExtras("name", element.getNameElement(), false);
64902    }
64903    if (element.hasValue()) {
64904      composeType("value", element.getValue());
64905    }
64906  }
64907
64908  protected void composeValueSetValueSetExpansionContainsComponent(String name,
64909      ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
64910    if (element != null) {
64911      open(name);
64912      composeValueSetValueSetExpansionContainsComponentInner(element);
64913      close();
64914    }
64915  }
64916
64917  protected void composeValueSetValueSetExpansionContainsComponentInner(
64918      ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
64919    composeBackbone(element);
64920    if (element.hasSystemElement()) {
64921      composeUriCore("system", element.getSystemElement(), false);
64922      composeUriExtras("system", element.getSystemElement(), false);
64923    }
64924    if (element.hasAbstractElement()) {
64925      composeBooleanCore("abstract", element.getAbstractElement(), false);
64926      composeBooleanExtras("abstract", element.getAbstractElement(), false);
64927    }
64928    if (element.hasInactiveElement()) {
64929      composeBooleanCore("inactive", element.getInactiveElement(), false);
64930      composeBooleanExtras("inactive", element.getInactiveElement(), false);
64931    }
64932    if (element.hasVersionElement()) {
64933      composeStringCore("version", element.getVersionElement(), false);
64934      composeStringExtras("version", element.getVersionElement(), false);
64935    }
64936    if (element.hasCodeElement()) {
64937      composeCodeCore("code", element.getCodeElement(), false);
64938      composeCodeExtras("code", element.getCodeElement(), false);
64939    }
64940    if (element.hasDisplayElement()) {
64941      composeStringCore("display", element.getDisplayElement(), false);
64942      composeStringExtras("display", element.getDisplayElement(), false);
64943    }
64944    if (element.hasDesignation()) {
64945      openArray("designation");
64946      for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation())
64947        composeValueSetConceptReferenceDesignationComponent(null, e);
64948      closeArray();
64949    }
64950    ;
64951    if (element.hasContains()) {
64952      openArray("contains");
64953      for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains())
64954        composeValueSetValueSetExpansionContainsComponent(null, e);
64955      closeArray();
64956    }
64957    ;
64958  }
64959
64960  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
64961    if (element != null) {
64962      prop("resourceType", name);
64963      composeVerificationResultInner(element);
64964    }
64965  }
64966
64967  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
64968    composeDomainResourceElements(element);
64969    if (element.hasTarget()) {
64970      openArray("target");
64971      for (Reference e : element.getTarget())
64972        composeReference(null, e);
64973      closeArray();
64974    }
64975    ;
64976    if (element.hasTargetLocation()) {
64977      openArray("targetLocation");
64978      for (StringType e : element.getTargetLocation())
64979        composeStringCore(null, e, true);
64980      closeArray();
64981      if (anyHasExtras(element.getTargetLocation())) {
64982        openArray("_targetLocation");
64983        for (StringType e : element.getTargetLocation())
64984          composeStringExtras(null, e, true);
64985        closeArray();
64986      }
64987    }
64988    ;
64989    if (element.hasNeed()) {
64990      composeCodeableConcept("need", element.getNeed());
64991    }
64992    if (element.hasStatusElement()) {
64993      composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
64994      composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
64995    }
64996    if (element.hasStatusDateElement()) {
64997      composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
64998      composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
64999    }
65000    if (element.hasValidationType()) {
65001      composeCodeableConcept("validationType", element.getValidationType());
65002    }
65003    if (element.hasValidationProcess()) {
65004      openArray("validationProcess");
65005      for (CodeableConcept e : element.getValidationProcess())
65006        composeCodeableConcept(null, e);
65007      closeArray();
65008    }
65009    ;
65010    if (element.hasFrequency()) {
65011      composeTiming("frequency", element.getFrequency());
65012    }
65013    if (element.hasLastPerformedElement()) {
65014      composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
65015      composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
65016    }
65017    if (element.hasNextScheduledElement()) {
65018      composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
65019      composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
65020    }
65021    if (element.hasFailureAction()) {
65022      composeCodeableConcept("failureAction", element.getFailureAction());
65023    }
65024    if (element.hasPrimarySource()) {
65025      openArray("primarySource");
65026      for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource())
65027        composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
65028      closeArray();
65029    }
65030    ;
65031    if (element.hasAttestation()) {
65032      composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
65033    }
65034    if (element.hasValidator()) {
65035      openArray("validator");
65036      for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator())
65037        composeVerificationResultVerificationResultValidatorComponent(null, e);
65038      closeArray();
65039    }
65040    ;
65041  }
65042
65043  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name,
65044      VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
65045    if (element != null) {
65046      open(name);
65047      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
65048      close();
65049    }
65050  }
65051
65052  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(
65053      VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
65054    composeBackbone(element);
65055    if (element.hasWho()) {
65056      composeReference("who", element.getWho());
65057    }
65058    if (element.hasType()) {
65059      openArray("type");
65060      for (CodeableConcept e : element.getType())
65061        composeCodeableConcept(null, e);
65062      closeArray();
65063    }
65064    ;
65065    if (element.hasCommunicationMethod()) {
65066      openArray("communicationMethod");
65067      for (CodeableConcept e : element.getCommunicationMethod())
65068        composeCodeableConcept(null, e);
65069      closeArray();
65070    }
65071    ;
65072    if (element.hasValidationStatus()) {
65073      composeCodeableConcept("validationStatus", element.getValidationStatus());
65074    }
65075    if (element.hasValidationDateElement()) {
65076      composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
65077      composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
65078    }
65079    if (element.hasCanPushUpdates()) {
65080      composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
65081    }
65082    if (element.hasPushTypeAvailable()) {
65083      openArray("pushTypeAvailable");
65084      for (CodeableConcept e : element.getPushTypeAvailable())
65085        composeCodeableConcept(null, e);
65086      closeArray();
65087    }
65088    ;
65089  }
65090
65091  protected void composeVerificationResultVerificationResultAttestationComponent(String name,
65092      VerificationResult.VerificationResultAttestationComponent element) throws IOException {
65093    if (element != null) {
65094      open(name);
65095      composeVerificationResultVerificationResultAttestationComponentInner(element);
65096      close();
65097    }
65098  }
65099
65100  protected void composeVerificationResultVerificationResultAttestationComponentInner(
65101      VerificationResult.VerificationResultAttestationComponent element) throws IOException {
65102    composeBackbone(element);
65103    if (element.hasWho()) {
65104      composeReference("who", element.getWho());
65105    }
65106    if (element.hasOnBehalfOf()) {
65107      composeReference("onBehalfOf", element.getOnBehalfOf());
65108    }
65109    if (element.hasCommunicationMethod()) {
65110      composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
65111    }
65112    if (element.hasDateElement()) {
65113      composeDateCore("date", element.getDateElement(), false);
65114      composeDateExtras("date", element.getDateElement(), false);
65115    }
65116    if (element.hasSourceIdentityCertificateElement()) {
65117      composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
65118      composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
65119    }
65120    if (element.hasProxyIdentityCertificateElement()) {
65121      composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
65122      composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
65123    }
65124    if (element.hasProxySignature()) {
65125      composeSignature("proxySignature", element.getProxySignature());
65126    }
65127    if (element.hasSourceSignature()) {
65128      composeSignature("sourceSignature", element.getSourceSignature());
65129    }
65130  }
65131
65132  protected void composeVerificationResultVerificationResultValidatorComponent(String name,
65133      VerificationResult.VerificationResultValidatorComponent element) throws IOException {
65134    if (element != null) {
65135      open(name);
65136      composeVerificationResultVerificationResultValidatorComponentInner(element);
65137      close();
65138    }
65139  }
65140
65141  protected void composeVerificationResultVerificationResultValidatorComponentInner(
65142      VerificationResult.VerificationResultValidatorComponent element) throws IOException {
65143    composeBackbone(element);
65144    if (element.hasOrganization()) {
65145      composeReference("organization", element.getOrganization());
65146    }
65147    if (element.hasIdentityCertificateElement()) {
65148      composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
65149      composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
65150    }
65151    if (element.hasAttestationSignature()) {
65152      composeSignature("attestationSignature", element.getAttestationSignature());
65153    }
65154  }
65155
65156  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
65157    if (element != null) {
65158      prop("resourceType", name);
65159      composeVisionPrescriptionInner(element);
65160    }
65161  }
65162
65163  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
65164    composeDomainResourceElements(element);
65165    if (element.hasIdentifier()) {
65166      openArray("identifier");
65167      for (Identifier e : element.getIdentifier())
65168        composeIdentifier(null, e);
65169      closeArray();
65170    }
65171    ;
65172    if (element.hasStatusElement()) {
65173      composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(),
65174          false);
65175      composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(),
65176          false);
65177    }
65178    if (element.hasCreatedElement()) {
65179      composeDateTimeCore("created", element.getCreatedElement(), false);
65180      composeDateTimeExtras("created", element.getCreatedElement(), false);
65181    }
65182    if (element.hasPatient()) {
65183      composeReference("patient", element.getPatient());
65184    }
65185    if (element.hasEncounter()) {
65186      composeReference("encounter", element.getEncounter());
65187    }
65188    if (element.hasDateWrittenElement()) {
65189      composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
65190      composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
65191    }
65192    if (element.hasPrescriber()) {
65193      composeReference("prescriber", element.getPrescriber());
65194    }
65195    if (element.hasLensSpecification()) {
65196      openArray("lensSpecification");
65197      for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification())
65198        composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(null, e);
65199      closeArray();
65200    }
65201    ;
65202  }
65203
65204  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(String name,
65205      VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
65206    if (element != null) {
65207      open(name);
65208      composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(element);
65209      close();
65210    }
65211  }
65212
65213  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(
65214      VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
65215    composeBackbone(element);
65216    if (element.hasProduct()) {
65217      composeCodeableConcept("product", element.getProduct());
65218    }
65219    if (element.hasEyeElement()) {
65220      composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
65221      composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
65222    }
65223    if (element.hasSphereElement()) {
65224      composeDecimalCore("sphere", element.getSphereElement(), false);
65225      composeDecimalExtras("sphere", element.getSphereElement(), false);
65226    }
65227    if (element.hasCylinderElement()) {
65228      composeDecimalCore("cylinder", element.getCylinderElement(), false);
65229      composeDecimalExtras("cylinder", element.getCylinderElement(), false);
65230    }
65231    if (element.hasAxisElement()) {
65232      composeIntegerCore("axis", element.getAxisElement(), false);
65233      composeIntegerExtras("axis", element.getAxisElement(), false);
65234    }
65235    if (element.hasPrism()) {
65236      openArray("prism");
65237      for (VisionPrescription.PrismComponent e : element.getPrism())
65238        composeVisionPrescriptionPrismComponent(null, e);
65239      closeArray();
65240    }
65241    ;
65242    if (element.hasAddElement()) {
65243      composeDecimalCore("add", element.getAddElement(), false);
65244      composeDecimalExtras("add", element.getAddElement(), false);
65245    }
65246    if (element.hasPowerElement()) {
65247      composeDecimalCore("power", element.getPowerElement(), false);
65248      composeDecimalExtras("power", element.getPowerElement(), false);
65249    }
65250    if (element.hasBackCurveElement()) {
65251      composeDecimalCore("backCurve", element.getBackCurveElement(), false);
65252      composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
65253    }
65254    if (element.hasDiameterElement()) {
65255      composeDecimalCore("diameter", element.getDiameterElement(), false);
65256      composeDecimalExtras("diameter", element.getDiameterElement(), false);
65257    }
65258    if (element.hasDuration()) {
65259      composeQuantity("duration", element.getDuration());
65260    }
65261    if (element.hasColorElement()) {
65262      composeStringCore("color", element.getColorElement(), false);
65263      composeStringExtras("color", element.getColorElement(), false);
65264    }
65265    if (element.hasBrandElement()) {
65266      composeStringCore("brand", element.getBrandElement(), false);
65267      composeStringExtras("brand", element.getBrandElement(), false);
65268    }
65269    if (element.hasNote()) {
65270      openArray("note");
65271      for (Annotation e : element.getNote())
65272        composeAnnotation(null, e);
65273      closeArray();
65274    }
65275    ;
65276  }
65277
65278  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element)
65279      throws IOException {
65280    if (element != null) {
65281      open(name);
65282      composeVisionPrescriptionPrismComponentInner(element);
65283      close();
65284    }
65285  }
65286
65287  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element)
65288      throws IOException {
65289    composeBackbone(element);
65290    if (element.hasAmountElement()) {
65291      composeDecimalCore("amount", element.getAmountElement(), false);
65292      composeDecimalExtras("amount", element.getAmountElement(), false);
65293    }
65294    if (element.hasBaseElement()) {
65295      composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
65296      composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
65297    }
65298  }
65299
65300  @Override
65301  protected void composeResource(Resource resource) throws IOException {
65302    if (resource instanceof Parameters)
65303      composeParameters("Parameters", (Parameters) resource);
65304    else if (resource instanceof Account)
65305      composeAccount("Account", (Account) resource);
65306    else if (resource instanceof ActivityDefinition)
65307      composeActivityDefinition("ActivityDefinition", (ActivityDefinition) resource);
65308    else if (resource instanceof AdverseEvent)
65309      composeAdverseEvent("AdverseEvent", (AdverseEvent) resource);
65310    else if (resource instanceof AllergyIntolerance)
65311      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance) resource);
65312    else if (resource instanceof Appointment)
65313      composeAppointment("Appointment", (Appointment) resource);
65314    else if (resource instanceof AppointmentResponse)
65315      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse) resource);
65316    else if (resource instanceof AuditEvent)
65317      composeAuditEvent("AuditEvent", (AuditEvent) resource);
65318    else if (resource instanceof Basic)
65319      composeBasic("Basic", (Basic) resource);
65320    else if (resource instanceof Binary)
65321      composeBinary("Binary", (Binary) resource);
65322    else if (resource instanceof BiologicallyDerivedProduct)
65323      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct) resource);
65324    else if (resource instanceof BodyStructure)
65325      composeBodyStructure("BodyStructure", (BodyStructure) resource);
65326    else if (resource instanceof Bundle)
65327      composeBundle("Bundle", (Bundle) resource);
65328    else if (resource instanceof CapabilityStatement)
65329      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement) resource);
65330    else if (resource instanceof CarePlan)
65331      composeCarePlan("CarePlan", (CarePlan) resource);
65332    else if (resource instanceof CareTeam)
65333      composeCareTeam("CareTeam", (CareTeam) resource);
65334    else if (resource instanceof CatalogEntry)
65335      composeCatalogEntry("CatalogEntry", (CatalogEntry) resource);
65336    else if (resource instanceof ChargeItem)
65337      composeChargeItem("ChargeItem", (ChargeItem) resource);
65338    else if (resource instanceof ChargeItemDefinition)
65339      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition) resource);
65340    else if (resource instanceof Claim)
65341      composeClaim("Claim", (Claim) resource);
65342    else if (resource instanceof ClaimResponse)
65343      composeClaimResponse("ClaimResponse", (ClaimResponse) resource);
65344    else if (resource instanceof ClinicalImpression)
65345      composeClinicalImpression("ClinicalImpression", (ClinicalImpression) resource);
65346    else if (resource instanceof CodeSystem)
65347      composeCodeSystem("CodeSystem", (CodeSystem) resource);
65348    else if (resource instanceof Communication)
65349      composeCommunication("Communication", (Communication) resource);
65350    else if (resource instanceof CommunicationRequest)
65351      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest) resource);
65352    else if (resource instanceof CompartmentDefinition)
65353      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition) resource);
65354    else if (resource instanceof Composition)
65355      composeComposition("Composition", (Composition) resource);
65356    else if (resource instanceof ConceptMap)
65357      composeConceptMap("ConceptMap", (ConceptMap) resource);
65358    else if (resource instanceof Condition)
65359      composeCondition("Condition", (Condition) resource);
65360    else if (resource instanceof Consent)
65361      composeConsent("Consent", (Consent) resource);
65362    else if (resource instanceof Contract)
65363      composeContract("Contract", (Contract) resource);
65364    else if (resource instanceof Coverage)
65365      composeCoverage("Coverage", (Coverage) resource);
65366    else if (resource instanceof CoverageEligibilityRequest)
65367      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest) resource);
65368    else if (resource instanceof CoverageEligibilityResponse)
65369      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse) resource);
65370    else if (resource instanceof DetectedIssue)
65371      composeDetectedIssue("DetectedIssue", (DetectedIssue) resource);
65372    else if (resource instanceof Device)
65373      composeDevice("Device", (Device) resource);
65374    else if (resource instanceof DeviceDefinition)
65375      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition) resource);
65376    else if (resource instanceof DeviceMetric)
65377      composeDeviceMetric("DeviceMetric", (DeviceMetric) resource);
65378    else if (resource instanceof DeviceRequest)
65379      composeDeviceRequest("DeviceRequest", (DeviceRequest) resource);
65380    else if (resource instanceof DeviceUseStatement)
65381      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement) resource);
65382    else if (resource instanceof DiagnosticReport)
65383      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport) resource);
65384    else if (resource instanceof DocumentManifest)
65385      composeDocumentManifest("DocumentManifest", (DocumentManifest) resource);
65386    else if (resource instanceof DocumentReference)
65387      composeDocumentReference("DocumentReference", (DocumentReference) resource);
65388    else if (resource instanceof EffectEvidenceSynthesis)
65389      composeEffectEvidenceSynthesis("EffectEvidenceSynthesis", (EffectEvidenceSynthesis) resource);
65390    else if (resource instanceof Encounter)
65391      composeEncounter("Encounter", (Encounter) resource);
65392    else if (resource instanceof Endpoint)
65393      composeEndpoint("Endpoint", (Endpoint) resource);
65394    else if (resource instanceof EnrollmentRequest)
65395      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest) resource);
65396    else if (resource instanceof EnrollmentResponse)
65397      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse) resource);
65398    else if (resource instanceof EpisodeOfCare)
65399      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare) resource);
65400    else if (resource instanceof EventDefinition)
65401      composeEventDefinition("EventDefinition", (EventDefinition) resource);
65402    else if (resource instanceof Evidence)
65403      composeEvidence("Evidence", (Evidence) resource);
65404    else if (resource instanceof EvidenceVariable)
65405      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable) resource);
65406    else if (resource instanceof ExampleScenario)
65407      composeExampleScenario("ExampleScenario", (ExampleScenario) resource);
65408    else if (resource instanceof ExplanationOfBenefit)
65409      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit) resource);
65410    else if (resource instanceof FamilyMemberHistory)
65411      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory) resource);
65412    else if (resource instanceof Flag)
65413      composeFlag("Flag", (Flag) resource);
65414    else if (resource instanceof Goal)
65415      composeGoal("Goal", (Goal) resource);
65416    else if (resource instanceof GraphDefinition)
65417      composeGraphDefinition("GraphDefinition", (GraphDefinition) resource);
65418    else if (resource instanceof Group)
65419      composeGroup("Group", (Group) resource);
65420    else if (resource instanceof GuidanceResponse)
65421      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse) resource);
65422    else if (resource instanceof HealthcareService)
65423      composeHealthcareService("HealthcareService", (HealthcareService) resource);
65424    else if (resource instanceof ImagingStudy)
65425      composeImagingStudy("ImagingStudy", (ImagingStudy) resource);
65426    else if (resource instanceof Immunization)
65427      composeImmunization("Immunization", (Immunization) resource);
65428    else if (resource instanceof ImmunizationEvaluation)
65429      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation) resource);
65430    else if (resource instanceof ImmunizationRecommendation)
65431      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation) resource);
65432    else if (resource instanceof ImplementationGuide)
65433      composeImplementationGuide("ImplementationGuide", (ImplementationGuide) resource);
65434    else if (resource instanceof InsurancePlan)
65435      composeInsurancePlan("InsurancePlan", (InsurancePlan) resource);
65436    else if (resource instanceof Invoice)
65437      composeInvoice("Invoice", (Invoice) resource);
65438    else if (resource instanceof Library)
65439      composeLibrary("Library", (Library) resource);
65440    else if (resource instanceof Linkage)
65441      composeLinkage("Linkage", (Linkage) resource);
65442    else if (resource instanceof ListResource)
65443      composeListResource("List", (ListResource) resource);
65444    else if (resource instanceof Location)
65445      composeLocation("Location", (Location) resource);
65446    else if (resource instanceof Measure)
65447      composeMeasure("Measure", (Measure) resource);
65448    else if (resource instanceof MeasureReport)
65449      composeMeasureReport("MeasureReport", (MeasureReport) resource);
65450    else if (resource instanceof Media)
65451      composeMedia("Media", (Media) resource);
65452    else if (resource instanceof Medication)
65453      composeMedication("Medication", (Medication) resource);
65454    else if (resource instanceof MedicationAdministration)
65455      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration) resource);
65456    else if (resource instanceof MedicationDispense)
65457      composeMedicationDispense("MedicationDispense", (MedicationDispense) resource);
65458    else if (resource instanceof MedicationKnowledge)
65459      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge) resource);
65460    else if (resource instanceof MedicationRequest)
65461      composeMedicationRequest("MedicationRequest", (MedicationRequest) resource);
65462    else if (resource instanceof MedicationStatement)
65463      composeMedicationStatement("MedicationStatement", (MedicationStatement) resource);
65464    else if (resource instanceof MedicinalProduct)
65465      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct) resource);
65466    else if (resource instanceof MedicinalProductAuthorization)
65467      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization) resource);
65468    else if (resource instanceof MedicinalProductContraindication)
65469      composeMedicinalProductContraindication("MedicinalProductContraindication",
65470          (MedicinalProductContraindication) resource);
65471    else if (resource instanceof MedicinalProductIndication)
65472      composeMedicinalProductIndication("MedicinalProductIndication", (MedicinalProductIndication) resource);
65473    else if (resource instanceof MedicinalProductIngredient)
65474      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient) resource);
65475    else if (resource instanceof MedicinalProductInteraction)
65476      composeMedicinalProductInteraction("MedicinalProductInteraction", (MedicinalProductInteraction) resource);
65477    else if (resource instanceof MedicinalProductManufactured)
65478      composeMedicinalProductManufactured("MedicinalProductManufactured", (MedicinalProductManufactured) resource);
65479    else if (resource instanceof MedicinalProductPackaged)
65480      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged) resource);
65481    else if (resource instanceof MedicinalProductPharmaceutical)
65482      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical",
65483          (MedicinalProductPharmaceutical) resource);
65484    else if (resource instanceof MedicinalProductUndesirableEffect)
65485      composeMedicinalProductUndesirableEffect("MedicinalProductUndesirableEffect",
65486          (MedicinalProductUndesirableEffect) resource);
65487    else if (resource instanceof MessageDefinition)
65488      composeMessageDefinition("MessageDefinition", (MessageDefinition) resource);
65489    else if (resource instanceof MessageHeader)
65490      composeMessageHeader("MessageHeader", (MessageHeader) resource);
65491    else if (resource instanceof MolecularSequence)
65492      composeMolecularSequence("MolecularSequence", (MolecularSequence) resource);
65493    else if (resource instanceof NamingSystem)
65494      composeNamingSystem("NamingSystem", (NamingSystem) resource);
65495    else if (resource instanceof NutritionOrder)
65496      composeNutritionOrder("NutritionOrder", (NutritionOrder) resource);
65497    else if (resource instanceof Observation)
65498      composeObservation("Observation", (Observation) resource);
65499    else if (resource instanceof ObservationDefinition)
65500      composeObservationDefinition("ObservationDefinition", (ObservationDefinition) resource);
65501    else if (resource instanceof OperationDefinition)
65502      composeOperationDefinition("OperationDefinition", (OperationDefinition) resource);
65503    else if (resource instanceof OperationOutcome)
65504      composeOperationOutcome("OperationOutcome", (OperationOutcome) resource);
65505    else if (resource instanceof Organization)
65506      composeOrganization("Organization", (Organization) resource);
65507    else if (resource instanceof OrganizationAffiliation)
65508      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation) resource);
65509    else if (resource instanceof Patient)
65510      composePatient("Patient", (Patient) resource);
65511    else if (resource instanceof PaymentNotice)
65512      composePaymentNotice("PaymentNotice", (PaymentNotice) resource);
65513    else if (resource instanceof PaymentReconciliation)
65514      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation) resource);
65515    else if (resource instanceof Person)
65516      composePerson("Person", (Person) resource);
65517    else if (resource instanceof PlanDefinition)
65518      composePlanDefinition("PlanDefinition", (PlanDefinition) resource);
65519    else if (resource instanceof Practitioner)
65520      composePractitioner("Practitioner", (Practitioner) resource);
65521    else if (resource instanceof PractitionerRole)
65522      composePractitionerRole("PractitionerRole", (PractitionerRole) resource);
65523    else if (resource instanceof Procedure)
65524      composeProcedure("Procedure", (Procedure) resource);
65525    else if (resource instanceof Provenance)
65526      composeProvenance("Provenance", (Provenance) resource);
65527    else if (resource instanceof Questionnaire)
65528      composeQuestionnaire("Questionnaire", (Questionnaire) resource);
65529    else if (resource instanceof QuestionnaireResponse)
65530      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse) resource);
65531    else if (resource instanceof RelatedPerson)
65532      composeRelatedPerson("RelatedPerson", (RelatedPerson) resource);
65533    else if (resource instanceof RequestGroup)
65534      composeRequestGroup("RequestGroup", (RequestGroup) resource);
65535    else if (resource instanceof ResearchDefinition)
65536      composeResearchDefinition("ResearchDefinition", (ResearchDefinition) resource);
65537    else if (resource instanceof ResearchElementDefinition)
65538      composeResearchElementDefinition("ResearchElementDefinition", (ResearchElementDefinition) resource);
65539    else if (resource instanceof ResearchStudy)
65540      composeResearchStudy("ResearchStudy", (ResearchStudy) resource);
65541    else if (resource instanceof ResearchSubject)
65542      composeResearchSubject("ResearchSubject", (ResearchSubject) resource);
65543    else if (resource instanceof RiskAssessment)
65544      composeRiskAssessment("RiskAssessment", (RiskAssessment) resource);
65545    else if (resource instanceof RiskEvidenceSynthesis)
65546      composeRiskEvidenceSynthesis("RiskEvidenceSynthesis", (RiskEvidenceSynthesis) resource);
65547    else if (resource instanceof Schedule)
65548      composeSchedule("Schedule", (Schedule) resource);
65549    else if (resource instanceof SearchParameter)
65550      composeSearchParameter("SearchParameter", (SearchParameter) resource);
65551    else if (resource instanceof ServiceRequest)
65552      composeServiceRequest("ServiceRequest", (ServiceRequest) resource);
65553    else if (resource instanceof Slot)
65554      composeSlot("Slot", (Slot) resource);
65555    else if (resource instanceof Specimen)
65556      composeSpecimen("Specimen", (Specimen) resource);
65557    else if (resource instanceof SpecimenDefinition)
65558      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition) resource);
65559    else if (resource instanceof StructureDefinition)
65560      composeStructureDefinition("StructureDefinition", (StructureDefinition) resource);
65561    else if (resource instanceof StructureMap)
65562      composeStructureMap("StructureMap", (StructureMap) resource);
65563    else if (resource instanceof Subscription)
65564      composeSubscription("Subscription", (Subscription) resource);
65565    else if (resource instanceof Substance)
65566      composeSubstance("Substance", (Substance) resource);
65567    else if (resource instanceof SubstanceNucleicAcid)
65568      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid) resource);
65569    else if (resource instanceof SubstancePolymer)
65570      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer) resource);
65571    else if (resource instanceof SubstanceProtein)
65572      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein) resource);
65573    else if (resource instanceof SubstanceReferenceInformation)
65574      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation) resource);
65575    else if (resource instanceof SubstanceSourceMaterial)
65576      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial) resource);
65577    else if (resource instanceof SubstanceSpecification)
65578      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification) resource);
65579    else if (resource instanceof SupplyDelivery)
65580      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery) resource);
65581    else if (resource instanceof SupplyRequest)
65582      composeSupplyRequest("SupplyRequest", (SupplyRequest) resource);
65583    else if (resource instanceof Task)
65584      composeTask("Task", (Task) resource);
65585    else if (resource instanceof TerminologyCapabilities)
65586      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities) resource);
65587    else if (resource instanceof TestReport)
65588      composeTestReport("TestReport", (TestReport) resource);
65589    else if (resource instanceof TestScript)
65590      composeTestScript("TestScript", (TestScript) resource);
65591    else if (resource instanceof ValueSet)
65592      composeValueSet("ValueSet", (ValueSet) resource);
65593    else if (resource instanceof VerificationResult)
65594      composeVerificationResult("VerificationResult", (VerificationResult) resource);
65595    else if (resource instanceof VisionPrescription)
65596      composeVisionPrescription("VisionPrescription", (VisionPrescription) resource);
65597    else if (resource instanceof Binary)
65598      composeBinary("Binary", (Binary) resource);
65599    else
65600      throw new Error("Unhandled resource type " + resource.getClass().getName());
65601  }
65602
65603  protected void composeNamedReference(String name, Resource resource) throws IOException {
65604    if (resource instanceof Parameters)
65605      composeParameters(name, (Parameters) resource);
65606    else if (resource instanceof Account)
65607      composeAccount(name, (Account) resource);
65608    else if (resource instanceof ActivityDefinition)
65609      composeActivityDefinition(name, (ActivityDefinition) resource);
65610    else if (resource instanceof AdverseEvent)
65611      composeAdverseEvent(name, (AdverseEvent) resource);
65612    else if (resource instanceof AllergyIntolerance)
65613      composeAllergyIntolerance(name, (AllergyIntolerance) resource);
65614    else if (resource instanceof Appointment)
65615      composeAppointment(name, (Appointment) resource);
65616    else if (resource instanceof AppointmentResponse)
65617      composeAppointmentResponse(name, (AppointmentResponse) resource);
65618    else if (resource instanceof AuditEvent)
65619      composeAuditEvent(name, (AuditEvent) resource);
65620    else if (resource instanceof Basic)
65621      composeBasic(name, (Basic) resource);
65622    else if (resource instanceof Binary)
65623      composeBinary(name, (Binary) resource);
65624    else if (resource instanceof BiologicallyDerivedProduct)
65625      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct) resource);
65626    else if (resource instanceof BodyStructure)
65627      composeBodyStructure(name, (BodyStructure) resource);
65628    else if (resource instanceof Bundle)
65629      composeBundle(name, (Bundle) resource);
65630    else if (resource instanceof CapabilityStatement)
65631      composeCapabilityStatement(name, (CapabilityStatement) resource);
65632    else if (resource instanceof CarePlan)
65633      composeCarePlan(name, (CarePlan) resource);
65634    else if (resource instanceof CareTeam)
65635      composeCareTeam(name, (CareTeam) resource);
65636    else if (resource instanceof CatalogEntry)
65637      composeCatalogEntry(name, (CatalogEntry) resource);
65638    else if (resource instanceof ChargeItem)
65639      composeChargeItem(name, (ChargeItem) resource);
65640    else if (resource instanceof ChargeItemDefinition)
65641      composeChargeItemDefinition(name, (ChargeItemDefinition) resource);
65642    else if (resource instanceof Claim)
65643      composeClaim(name, (Claim) resource);
65644    else if (resource instanceof ClaimResponse)
65645      composeClaimResponse(name, (ClaimResponse) resource);
65646    else if (resource instanceof ClinicalImpression)
65647      composeClinicalImpression(name, (ClinicalImpression) resource);
65648    else if (resource instanceof CodeSystem)
65649      composeCodeSystem(name, (CodeSystem) resource);
65650    else if (resource instanceof Communication)
65651      composeCommunication(name, (Communication) resource);
65652    else if (resource instanceof CommunicationRequest)
65653      composeCommunicationRequest(name, (CommunicationRequest) resource);
65654    else if (resource instanceof CompartmentDefinition)
65655      composeCompartmentDefinition(name, (CompartmentDefinition) resource);
65656    else if (resource instanceof Composition)
65657      composeComposition(name, (Composition) resource);
65658    else if (resource instanceof ConceptMap)
65659      composeConceptMap(name, (ConceptMap) resource);
65660    else if (resource instanceof Condition)
65661      composeCondition(name, (Condition) resource);
65662    else if (resource instanceof Consent)
65663      composeConsent(name, (Consent) resource);
65664    else if (resource instanceof Contract)
65665      composeContract(name, (Contract) resource);
65666    else if (resource instanceof Coverage)
65667      composeCoverage(name, (Coverage) resource);
65668    else if (resource instanceof CoverageEligibilityRequest)
65669      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest) resource);
65670    else if (resource instanceof CoverageEligibilityResponse)
65671      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse) resource);
65672    else if (resource instanceof DetectedIssue)
65673      composeDetectedIssue(name, (DetectedIssue) resource);
65674    else if (resource instanceof Device)
65675      composeDevice(name, (Device) resource);
65676    else if (resource instanceof DeviceDefinition)
65677      composeDeviceDefinition(name, (DeviceDefinition) resource);
65678    else if (resource instanceof DeviceMetric)
65679      composeDeviceMetric(name, (DeviceMetric) resource);
65680    else if (resource instanceof DeviceRequest)
65681      composeDeviceRequest(name, (DeviceRequest) resource);
65682    else if (resource instanceof DeviceUseStatement)
65683      composeDeviceUseStatement(name, (DeviceUseStatement) resource);
65684    else if (resource instanceof DiagnosticReport)
65685      composeDiagnosticReport(name, (DiagnosticReport) resource);
65686    else if (resource instanceof DocumentManifest)
65687      composeDocumentManifest(name, (DocumentManifest) resource);
65688    else if (resource instanceof DocumentReference)
65689      composeDocumentReference(name, (DocumentReference) resource);
65690    else if (resource instanceof EffectEvidenceSynthesis)
65691      composeEffectEvidenceSynthesis(name, (EffectEvidenceSynthesis) resource);
65692    else if (resource instanceof Encounter)
65693      composeEncounter(name, (Encounter) resource);
65694    else if (resource instanceof Endpoint)
65695      composeEndpoint(name, (Endpoint) resource);
65696    else if (resource instanceof EnrollmentRequest)
65697      composeEnrollmentRequest(name, (EnrollmentRequest) resource);
65698    else if (resource instanceof EnrollmentResponse)
65699      composeEnrollmentResponse(name, (EnrollmentResponse) resource);
65700    else if (resource instanceof EpisodeOfCare)
65701      composeEpisodeOfCare(name, (EpisodeOfCare) resource);
65702    else if (resource instanceof EventDefinition)
65703      composeEventDefinition(name, (EventDefinition) resource);
65704    else if (resource instanceof Evidence)
65705      composeEvidence(name, (Evidence) resource);
65706    else if (resource instanceof EvidenceVariable)
65707      composeEvidenceVariable(name, (EvidenceVariable) resource);
65708    else if (resource instanceof ExampleScenario)
65709      composeExampleScenario(name, (ExampleScenario) resource);
65710    else if (resource instanceof ExplanationOfBenefit)
65711      composeExplanationOfBenefit(name, (ExplanationOfBenefit) resource);
65712    else if (resource instanceof FamilyMemberHistory)
65713      composeFamilyMemberHistory(name, (FamilyMemberHistory) resource);
65714    else if (resource instanceof Flag)
65715      composeFlag(name, (Flag) resource);
65716    else if (resource instanceof Goal)
65717      composeGoal(name, (Goal) resource);
65718    else if (resource instanceof GraphDefinition)
65719      composeGraphDefinition(name, (GraphDefinition) resource);
65720    else if (resource instanceof Group)
65721      composeGroup(name, (Group) resource);
65722    else if (resource instanceof GuidanceResponse)
65723      composeGuidanceResponse(name, (GuidanceResponse) resource);
65724    else if (resource instanceof HealthcareService)
65725      composeHealthcareService(name, (HealthcareService) resource);
65726    else if (resource instanceof ImagingStudy)
65727      composeImagingStudy(name, (ImagingStudy) resource);
65728    else if (resource instanceof Immunization)
65729      composeImmunization(name, (Immunization) resource);
65730    else if (resource instanceof ImmunizationEvaluation)
65731      composeImmunizationEvaluation(name, (ImmunizationEvaluation) resource);
65732    else if (resource instanceof ImmunizationRecommendation)
65733      composeImmunizationRecommendation(name, (ImmunizationRecommendation) resource);
65734    else if (resource instanceof ImplementationGuide)
65735      composeImplementationGuide(name, (ImplementationGuide) resource);
65736    else if (resource instanceof InsurancePlan)
65737      composeInsurancePlan(name, (InsurancePlan) resource);
65738    else if (resource instanceof Invoice)
65739      composeInvoice(name, (Invoice) resource);
65740    else if (resource instanceof Library)
65741      composeLibrary(name, (Library) resource);
65742    else if (resource instanceof Linkage)
65743      composeLinkage(name, (Linkage) resource);
65744    else if (resource instanceof ListResource)
65745      composeListResource(name, (ListResource) resource);
65746    else if (resource instanceof Location)
65747      composeLocation(name, (Location) resource);
65748    else if (resource instanceof Measure)
65749      composeMeasure(name, (Measure) resource);
65750    else if (resource instanceof MeasureReport)
65751      composeMeasureReport(name, (MeasureReport) resource);
65752    else if (resource instanceof Media)
65753      composeMedia(name, (Media) resource);
65754    else if (resource instanceof Medication)
65755      composeMedication(name, (Medication) resource);
65756    else if (resource instanceof MedicationAdministration)
65757      composeMedicationAdministration(name, (MedicationAdministration) resource);
65758    else if (resource instanceof MedicationDispense)
65759      composeMedicationDispense(name, (MedicationDispense) resource);
65760    else if (resource instanceof MedicationKnowledge)
65761      composeMedicationKnowledge(name, (MedicationKnowledge) resource);
65762    else if (resource instanceof MedicationRequest)
65763      composeMedicationRequest(name, (MedicationRequest) resource);
65764    else if (resource instanceof MedicationStatement)
65765      composeMedicationStatement(name, (MedicationStatement) resource);
65766    else if (resource instanceof MedicinalProduct)
65767      composeMedicinalProduct(name, (MedicinalProduct) resource);
65768    else if (resource instanceof MedicinalProductAuthorization)
65769      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization) resource);
65770    else if (resource instanceof MedicinalProductContraindication)
65771      composeMedicinalProductContraindication(name, (MedicinalProductContraindication) resource);
65772    else if (resource instanceof MedicinalProductIndication)
65773      composeMedicinalProductIndication(name, (MedicinalProductIndication) resource);
65774    else if (resource instanceof MedicinalProductIngredient)
65775      composeMedicinalProductIngredient(name, (MedicinalProductIngredient) resource);
65776    else if (resource instanceof MedicinalProductInteraction)
65777      composeMedicinalProductInteraction(name, (MedicinalProductInteraction) resource);
65778    else if (resource instanceof MedicinalProductManufactured)
65779      composeMedicinalProductManufactured(name, (MedicinalProductManufactured) resource);
65780    else if (resource instanceof MedicinalProductPackaged)
65781      composeMedicinalProductPackaged(name, (MedicinalProductPackaged) resource);
65782    else if (resource instanceof MedicinalProductPharmaceutical)
65783      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical) resource);
65784    else if (resource instanceof MedicinalProductUndesirableEffect)
65785      composeMedicinalProductUndesirableEffect(name, (MedicinalProductUndesirableEffect) resource);
65786    else if (resource instanceof MessageDefinition)
65787      composeMessageDefinition(name, (MessageDefinition) resource);
65788    else if (resource instanceof MessageHeader)
65789      composeMessageHeader(name, (MessageHeader) resource);
65790    else if (resource instanceof MolecularSequence)
65791      composeMolecularSequence(name, (MolecularSequence) resource);
65792    else if (resource instanceof NamingSystem)
65793      composeNamingSystem(name, (NamingSystem) resource);
65794    else if (resource instanceof NutritionOrder)
65795      composeNutritionOrder(name, (NutritionOrder) resource);
65796    else if (resource instanceof Observation)
65797      composeObservation(name, (Observation) resource);
65798    else if (resource instanceof ObservationDefinition)
65799      composeObservationDefinition(name, (ObservationDefinition) resource);
65800    else if (resource instanceof OperationDefinition)
65801      composeOperationDefinition(name, (OperationDefinition) resource);
65802    else if (resource instanceof OperationOutcome)
65803      composeOperationOutcome(name, (OperationOutcome) resource);
65804    else if (resource instanceof Organization)
65805      composeOrganization(name, (Organization) resource);
65806    else if (resource instanceof OrganizationAffiliation)
65807      composeOrganizationAffiliation(name, (OrganizationAffiliation) resource);
65808    else if (resource instanceof Patient)
65809      composePatient(name, (Patient) resource);
65810    else if (resource instanceof PaymentNotice)
65811      composePaymentNotice(name, (PaymentNotice) resource);
65812    else if (resource instanceof PaymentReconciliation)
65813      composePaymentReconciliation(name, (PaymentReconciliation) resource);
65814    else if (resource instanceof Person)
65815      composePerson(name, (Person) resource);
65816    else if (resource instanceof PlanDefinition)
65817      composePlanDefinition(name, (PlanDefinition) resource);
65818    else if (resource instanceof Practitioner)
65819      composePractitioner(name, (Practitioner) resource);
65820    else if (resource instanceof PractitionerRole)
65821      composePractitionerRole(name, (PractitionerRole) resource);
65822    else if (resource instanceof Procedure)
65823      composeProcedure(name, (Procedure) resource);
65824    else if (resource instanceof Provenance)
65825      composeProvenance(name, (Provenance) resource);
65826    else if (resource instanceof Questionnaire)
65827      composeQuestionnaire(name, (Questionnaire) resource);
65828    else if (resource instanceof QuestionnaireResponse)
65829      composeQuestionnaireResponse(name, (QuestionnaireResponse) resource);
65830    else if (resource instanceof RelatedPerson)
65831      composeRelatedPerson(name, (RelatedPerson) resource);
65832    else if (resource instanceof RequestGroup)
65833      composeRequestGroup(name, (RequestGroup) resource);
65834    else if (resource instanceof ResearchDefinition)
65835      composeResearchDefinition(name, (ResearchDefinition) resource);
65836    else if (resource instanceof ResearchElementDefinition)
65837      composeResearchElementDefinition(name, (ResearchElementDefinition) resource);
65838    else if (resource instanceof ResearchStudy)
65839      composeResearchStudy(name, (ResearchStudy) resource);
65840    else if (resource instanceof ResearchSubject)
65841      composeResearchSubject(name, (ResearchSubject) resource);
65842    else if (resource instanceof RiskAssessment)
65843      composeRiskAssessment(name, (RiskAssessment) resource);
65844    else if (resource instanceof RiskEvidenceSynthesis)
65845      composeRiskEvidenceSynthesis(name, (RiskEvidenceSynthesis) resource);
65846    else if (resource instanceof Schedule)
65847      composeSchedule(name, (Schedule) resource);
65848    else if (resource instanceof SearchParameter)
65849      composeSearchParameter(name, (SearchParameter) resource);
65850    else if (resource instanceof ServiceRequest)
65851      composeServiceRequest(name, (ServiceRequest) resource);
65852    else if (resource instanceof Slot)
65853      composeSlot(name, (Slot) resource);
65854    else if (resource instanceof Specimen)
65855      composeSpecimen(name, (Specimen) resource);
65856    else if (resource instanceof SpecimenDefinition)
65857      composeSpecimenDefinition(name, (SpecimenDefinition) resource);
65858    else if (resource instanceof StructureDefinition)
65859      composeStructureDefinition(name, (StructureDefinition) resource);
65860    else if (resource instanceof StructureMap)
65861      composeStructureMap(name, (StructureMap) resource);
65862    else if (resource instanceof Subscription)
65863      composeSubscription(name, (Subscription) resource);
65864    else if (resource instanceof Substance)
65865      composeSubstance(name, (Substance) resource);
65866    else if (resource instanceof SubstanceNucleicAcid)
65867      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid) resource);
65868    else if (resource instanceof SubstancePolymer)
65869      composeSubstancePolymer(name, (SubstancePolymer) resource);
65870    else if (resource instanceof SubstanceProtein)
65871      composeSubstanceProtein(name, (SubstanceProtein) resource);
65872    else if (resource instanceof SubstanceReferenceInformation)
65873      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation) resource);
65874    else if (resource instanceof SubstanceSourceMaterial)
65875      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial) resource);
65876    else if (resource instanceof SubstanceSpecification)
65877      composeSubstanceSpecification(name, (SubstanceSpecification) resource);
65878    else if (resource instanceof SupplyDelivery)
65879      composeSupplyDelivery(name, (SupplyDelivery) resource);
65880    else if (resource instanceof SupplyRequest)
65881      composeSupplyRequest(name, (SupplyRequest) resource);
65882    else if (resource instanceof Task)
65883      composeTask(name, (Task) resource);
65884    else if (resource instanceof TerminologyCapabilities)
65885      composeTerminologyCapabilities(name, (TerminologyCapabilities) resource);
65886    else if (resource instanceof TestReport)
65887      composeTestReport(name, (TestReport) resource);
65888    else if (resource instanceof TestScript)
65889      composeTestScript(name, (TestScript) resource);
65890    else if (resource instanceof ValueSet)
65891      composeValueSet(name, (ValueSet) resource);
65892    else if (resource instanceof VerificationResult)
65893      composeVerificationResult(name, (VerificationResult) resource);
65894    else if (resource instanceof VisionPrescription)
65895      composeVisionPrescription(name, (VisionPrescription) resource);
65896    else if (resource instanceof Binary)
65897      composeBinary(name, (Binary) resource);
65898    else
65899      throw new Error("Unhandled resource type " + resource.getClass().getName());
65900  }
65901
65902  protected void composeType(String prefix, Type type) throws IOException {
65903    if (type == null)
65904      ;
65905    else if (type instanceof Extension)
65906      composeExtension(prefix + "Extension", (Extension) type);
65907    else if (type instanceof Narrative)
65908      composeNarrative(prefix + "Narrative", (Narrative) type);
65909    else if (type instanceof Count)
65910      composeCount(prefix + "Count", (Count) type);
65911    else if (type instanceof Dosage)
65912      composeDosage(prefix + "Dosage", (Dosage) type);
65913    else if (type instanceof MarketingStatus)
65914      composeMarketingStatus(prefix + "MarketingStatus", (MarketingStatus) type);
65915    else if (type instanceof SubstanceAmount)
65916      composeSubstanceAmount(prefix + "SubstanceAmount", (SubstanceAmount) type);
65917    else if (type instanceof Population)
65918      composePopulation(prefix + "Population", (Population) type);
65919    else if (type instanceof Distance)
65920      composeDistance(prefix + "Distance", (Distance) type);
65921    else if (type instanceof Age)
65922      composeAge(prefix + "Age", (Age) type);
65923    else if (type instanceof Duration)
65924      composeDuration(prefix + "Duration", (Duration) type);
65925    else if (type instanceof ProductShelfLife)
65926      composeProductShelfLife(prefix + "ProductShelfLife", (ProductShelfLife) type);
65927    else if (type instanceof Timing)
65928      composeTiming(prefix + "Timing", (Timing) type);
65929    else if (type instanceof ProdCharacteristic)
65930      composeProdCharacteristic(prefix + "ProdCharacteristic", (ProdCharacteristic) type);
65931    else if (type instanceof Meta)
65932      composeMeta(prefix + "Meta", (Meta) type);
65933    else if (type instanceof Address)
65934      composeAddress(prefix + "Address", (Address) type);
65935    else if (type instanceof Contributor)
65936      composeContributor(prefix + "Contributor", (Contributor) type);
65937    else if (type instanceof Attachment)
65938      composeAttachment(prefix + "Attachment", (Attachment) type);
65939    else if (type instanceof DataRequirement)
65940      composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
65941    else if (type instanceof Money)
65942      composeMoney(prefix + "Money", (Money) type);
65943    else if (type instanceof HumanName)
65944      composeHumanName(prefix + "HumanName", (HumanName) type);
65945    else if (type instanceof ContactPoint)
65946      composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
65947    else if (type instanceof Identifier)
65948      composeIdentifier(prefix + "Identifier", (Identifier) type);
65949    else if (type instanceof Coding)
65950      composeCoding(prefix + "Coding", (Coding) type);
65951    else if (type instanceof SampledData)
65952      composeSampledData(prefix + "SampledData", (SampledData) type);
65953    else if (type instanceof Ratio)
65954      composeRatio(prefix + "Ratio", (Ratio) type);
65955    else if (type instanceof Reference)
65956      composeReference(prefix + "Reference", (Reference) type);
65957    else if (type instanceof TriggerDefinition)
65958      composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
65959    else if (type instanceof Quantity)
65960      composeQuantity(prefix + "Quantity", (Quantity) type);
65961    else if (type instanceof Period)
65962      composePeriod(prefix + "Period", (Period) type);
65963    else if (type instanceof Range)
65964      composeRange(prefix + "Range", (Range) type);
65965    else if (type instanceof RelatedArtifact)
65966      composeRelatedArtifact(prefix + "RelatedArtifact", (RelatedArtifact) type);
65967    else if (type instanceof Annotation)
65968      composeAnnotation(prefix + "Annotation", (Annotation) type);
65969    else if (type instanceof ContactDetail)
65970      composeContactDetail(prefix + "ContactDetail", (ContactDetail) type);
65971    else if (type instanceof UsageContext)
65972      composeUsageContext(prefix + "UsageContext", (UsageContext) type);
65973    else if (type instanceof Expression)
65974      composeExpression(prefix + "Expression", (Expression) type);
65975    else if (type instanceof Signature)
65976      composeSignature(prefix + "Signature", (Signature) type);
65977    else if (type instanceof CodeableConcept)
65978      composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
65979    else if (type instanceof ParameterDefinition)
65980      composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
65981    else if (type instanceof CodeType) {
65982      composeCodeCore(prefix + "Code", (CodeType) type, false);
65983      composeCodeExtras(prefix + "Code", (CodeType) type, false);
65984    } else if (type instanceof OidType) {
65985      composeOidCore(prefix + "Oid", (OidType) type, false);
65986      composeOidExtras(prefix + "Oid", (OidType) type, false);
65987    } else if (type instanceof CanonicalType) {
65988      composeCanonicalCore(prefix + "Canonical", (CanonicalType) type, false);
65989      composeCanonicalExtras(prefix + "Canonical", (CanonicalType) type, false);
65990    } else if (type instanceof UuidType) {
65991      composeUuidCore(prefix + "Uuid", (UuidType) type, false);
65992      composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
65993    } else if (type instanceof UrlType) {
65994      composeUrlCore(prefix + "Url", (UrlType) type, false);
65995      composeUrlExtras(prefix + "Url", (UrlType) type, false);
65996    } else if (type instanceof UnsignedIntType) {
65997      composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
65998      composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
65999    } else if (type instanceof MarkdownType) {
66000      composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
66001      composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
66002    } else if (type instanceof IdType) {
66003      composeIdCore(prefix + "Id", (IdType) type, false);
66004      composeIdExtras(prefix + "Id", (IdType) type, false);
66005    } else if (type instanceof PositiveIntType) {
66006      composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
66007      composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
66008    } else if (type instanceof DateType) {
66009      composeDateCore(prefix + "Date", (DateType) type, false);
66010      composeDateExtras(prefix + "Date", (DateType) type, false);
66011    } else if (type instanceof DateTimeType) {
66012      composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
66013      composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
66014    } else if (type instanceof StringType) {
66015      composeStringCore(prefix + "String", (StringType) type, false);
66016      composeStringExtras(prefix + "String", (StringType) type, false);
66017    } else if (type instanceof IntegerType) {
66018      composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
66019      composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
66020    } else if (type instanceof UriType) {
66021      composeUriCore(prefix + "Uri", (UriType) type, false);
66022      composeUriExtras(prefix + "Uri", (UriType) type, false);
66023    } else if (type instanceof InstantType) {
66024      composeInstantCore(prefix + "Instant", (InstantType) type, false);
66025      composeInstantExtras(prefix + "Instant", (InstantType) type, false);
66026    } else if (type instanceof BooleanType) {
66027      composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
66028      composeBooleanExtras(prefix + "Boolean", (BooleanType) type, false);
66029    } else if (type instanceof Base64BinaryType) {
66030      composeBase64BinaryCore(prefix + "Base64Binary", (Base64BinaryType) type, false);
66031      composeBase64BinaryExtras(prefix + "Base64Binary", (Base64BinaryType) type, false);
66032    } else if (type instanceof TimeType) {
66033      composeTimeCore(prefix + "Time", (TimeType) type, false);
66034      composeTimeExtras(prefix + "Time", (TimeType) type, false);
66035    } else if (type instanceof DecimalType) {
66036      composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
66037      composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
66038    } else
66039      throw new Error("Unhandled type");
66040  }
66041
66042  protected void composeTypeInner(Type type) throws IOException {
66043    if (type == null)
66044      ;
66045    else if (type instanceof Extension)
66046      composeExtensionInner((Extension) type);
66047    else if (type instanceof Narrative)
66048      composeNarrativeInner((Narrative) type);
66049    else if (type instanceof Count)
66050      composeCountInner((Count) type);
66051    else if (type instanceof Dosage)
66052      composeDosageInner((Dosage) type);
66053    else if (type instanceof MarketingStatus)
66054      composeMarketingStatusInner((MarketingStatus) type);
66055    else if (type instanceof SubstanceAmount)
66056      composeSubstanceAmountInner((SubstanceAmount) type);
66057    else if (type instanceof Population)
66058      composePopulationInner((Population) type);
66059    else if (type instanceof Distance)
66060      composeDistanceInner((Distance) type);
66061    else if (type instanceof Age)
66062      composeAgeInner((Age) type);
66063    else if (type instanceof Duration)
66064      composeDurationInner((Duration) type);
66065    else if (type instanceof ProductShelfLife)
66066      composeProductShelfLifeInner((ProductShelfLife) type);
66067    else if (type instanceof Timing)
66068      composeTimingInner((Timing) type);
66069    else if (type instanceof ProdCharacteristic)
66070      composeProdCharacteristicInner((ProdCharacteristic) type);
66071    else if (type instanceof Meta)
66072      composeMetaInner((Meta) type);
66073    else if (type instanceof Address)
66074      composeAddressInner((Address) type);
66075    else if (type instanceof Contributor)
66076      composeContributorInner((Contributor) type);
66077    else if (type instanceof Attachment)
66078      composeAttachmentInner((Attachment) type);
66079    else if (type instanceof DataRequirement)
66080      composeDataRequirementInner((DataRequirement) type);
66081    else if (type instanceof Money)
66082      composeMoneyInner((Money) type);
66083    else if (type instanceof HumanName)
66084      composeHumanNameInner((HumanName) type);
66085    else if (type instanceof ContactPoint)
66086      composeContactPointInner((ContactPoint) type);
66087    else if (type instanceof Identifier)
66088      composeIdentifierInner((Identifier) type);
66089    else if (type instanceof Coding)
66090      composeCodingInner((Coding) type);
66091    else if (type instanceof SampledData)
66092      composeSampledDataInner((SampledData) type);
66093    else if (type instanceof Ratio)
66094      composeRatioInner((Ratio) type);
66095    else if (type instanceof Reference)
66096      composeReferenceInner((Reference) type);
66097    else if (type instanceof TriggerDefinition)
66098      composeTriggerDefinitionInner((TriggerDefinition) type);
66099    else if (type instanceof Quantity)
66100      composeQuantityInner((Quantity) type);
66101    else if (type instanceof Period)
66102      composePeriodInner((Period) type);
66103    else if (type instanceof Range)
66104      composeRangeInner((Range) type);
66105    else if (type instanceof RelatedArtifact)
66106      composeRelatedArtifactInner((RelatedArtifact) type);
66107    else if (type instanceof Annotation)
66108      composeAnnotationInner((Annotation) type);
66109    else if (type instanceof ContactDetail)
66110      composeContactDetailInner((ContactDetail) type);
66111    else if (type instanceof UsageContext)
66112      composeUsageContextInner((UsageContext) type);
66113    else if (type instanceof Expression)
66114      composeExpressionInner((Expression) type);
66115    else if (type instanceof Signature)
66116      composeSignatureInner((Signature) type);
66117    else if (type instanceof CodeableConcept)
66118      composeCodeableConceptInner((CodeableConcept) type);
66119    else if (type instanceof ParameterDefinition)
66120      composeParameterDefinitionInner((ParameterDefinition) type);
66121    else
66122      throw new Error("Unhandled type: " + type.fhirType());
66123  }
66124
66125}